{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "IyWDKt1wJhjq"
   },
   "source": [
    "# Data Types, Graphical Marks, and Visual Encoding Channels\n",
    "\n",
    "A visualization represents data using a collection of _graphical marks_ (bars, lines, points, etc.). The attributes of a mark &mdash; such as its position, shape, size, or color &mdash; serve as _channels_ through which we can encode underlying data values."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "With a basic framework of _data types_, _marks_, and _encoding channels_, we can concisely create a wide variety of visualizations. In this notebook, we explore each of these elements and show how to use them to create custom statistical graphics.\n",
    "\n",
    "_This notebook is part of the [data visualization curriculum](https://github.com/uwdata/visualization-curriculum)._"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "Y5K12kFBKE6v"
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import altair as alt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "dkfRE2_2KOZ9"
   },
   "source": [
    "## Global Development Data\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "LbfvKf2tzCmb"
   },
   "source": [
    "We will be visualizing global health and population data for a number of countries, over the time period of 1955 to 2005. The data was collected by the [Gapminder Foundation](https://www.gapminder.org/) and shared in [Hans Rosling's popular TED talk](https://www.youtube.com/watch?v=hVimVzgtD6w). If you haven't seen the talk, we encourage you to watch it first!\n",
    "\n",
    "Let's first load the dataset from the [vega-datasets](https://github.com/vega/vega-datasets) collection into a Pandas data frame."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "cMgPRofkJHJP"
   },
   "outputs": [],
   "source": [
    "from vega_datasets import data as vega_data\n",
    "data = pd.read_json(vega_data.gapminder.url)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "ioAtaF9P0IMX"
   },
   "source": [
    "How big is the data?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 34
    },
    "colab_type": "code",
    "id": "oM-Lodk_KK8T",
    "outputId": "134a2f4a-c15d-4fcd-fd93-49b26a4f5e30"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(693, 6)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "spJtZFQN0KCQ"
   },
   "source": [
    "693 rows and 6 columns! Let's take a peek at the data content:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 204
    },
    "colab_type": "code",
    "id": "SpB2dH0JKVJe",
    "outputId": "ec103505-4d8f-4310-a6e1-7eea3d789c28"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cluster</th>\n",
       "      <th>country</th>\n",
       "      <th>fertility</th>\n",
       "      <th>life_expect</th>\n",
       "      <th>pop</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.7</td>\n",
       "      <td>30.332</td>\n",
       "      <td>8891209</td>\n",
       "      <td>1955</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.7</td>\n",
       "      <td>31.997</td>\n",
       "      <td>9829450</td>\n",
       "      <td>1960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.7</td>\n",
       "      <td>34.020</td>\n",
       "      <td>10997885</td>\n",
       "      <td>1965</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.7</td>\n",
       "      <td>36.088</td>\n",
       "      <td>12430623</td>\n",
       "      <td>1970</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.7</td>\n",
       "      <td>38.438</td>\n",
       "      <td>14132019</td>\n",
       "      <td>1975</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   cluster      country  fertility  life_expect       pop  year\n",
       "0        0  Afghanistan        7.7       30.332   8891209  1955\n",
       "1        0  Afghanistan        7.7       31.997   9829450  1960\n",
       "2        0  Afghanistan        7.7       34.020  10997885  1965\n",
       "3        0  Afghanistan        7.7       36.088  12430623  1970\n",
       "4        0  Afghanistan        7.7       38.438  14132019  1975"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "ZpJ2OTZbY3Kf"
   },
   "source": [
    "For each `country` and `year` (in 5-year intervals), we have measures of fertility in terms of the number of children per woman (`fertility`), life expectancy in years (`life_expect`), and total population (`pop`).\n",
    "\n",
    "We also see a `cluster` field with an integer code. What might this represent? We'll try and solve this mystery as we visualize the data!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "nTSCOwsEvo15"
   },
   "source": [
    "Let's also create a smaller data frame, filtered down to values for the year 2000 only:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "kCVTdUK2Le_M"
   },
   "outputs": [],
   "source": [
    "data2000 = data.loc[data['year'] == 2000]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 204
    },
    "colab_type": "code",
    "id": "mOLR5Nh-MLWm",
    "outputId": "8629f998-e723-4b92-9a95-f0df3c9843a8"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cluster</th>\n",
       "      <th>country</th>\n",
       "      <th>fertility</th>\n",
       "      <th>life_expect</th>\n",
       "      <th>pop</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>7.4792</td>\n",
       "      <td>42.129</td>\n",
       "      <td>23898198</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>3</td>\n",
       "      <td>Argentina</td>\n",
       "      <td>2.3500</td>\n",
       "      <td>74.340</td>\n",
       "      <td>37497728</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>3</td>\n",
       "      <td>Aruba</td>\n",
       "      <td>2.1240</td>\n",
       "      <td>73.451</td>\n",
       "      <td>69539</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>4</td>\n",
       "      <td>Australia</td>\n",
       "      <td>1.7560</td>\n",
       "      <td>80.370</td>\n",
       "      <td>19164620</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>1</td>\n",
       "      <td>Austria</td>\n",
       "      <td>1.3820</td>\n",
       "      <td>78.980</td>\n",
       "      <td>8113413</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    cluster      country  fertility  life_expect       pop  year\n",
       "9         0  Afghanistan     7.4792       42.129  23898198  2000\n",
       "20        3    Argentina     2.3500       74.340  37497728  2000\n",
       "31        3        Aruba     2.1240       73.451     69539  2000\n",
       "42        4    Australia     1.7560       80.370  19164620  2000\n",
       "53        1      Austria     1.3820       78.980   8113413  2000"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2000.head(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "xyIb1bzLJgG-"
   },
   "source": [
    "## Data Types\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "vyj1xBF2NTY6"
   },
   "source": [
    "The first ingredient in effective visualization is the input data. Data values can represent different forms of measurement. What kinds of comparisons do those measurements support? And what kinds of visual encodings then support those comparisons?\n",
    "\n",
    "We will start by looking at the basic data types that Altair uses to inform visual encoding choices. These data types determine the kinds of comparisons we can make, and thereby guide our visualization design decisions.\n",
    "\n",
    "### Nominal (N)\n",
    "\n",
    "*Nominal* data (also called *categorical* data) consist of category names. \n",
    "\n",
    "With nominal data we can compare the equality of values: *is value A the same or different than value B? (A = B)*, supporting statements like “A is equal to B” or “A is not equal to B”.\n",
    "In the dataset above, the `country` field is nominal.\n",
    "\n",
    "When visualizing nominal data we should readily be able to see if values are the same or different: position, color hue (blue, red, green, *etc.*), and shape can help. However, using a size channel to encode nominal data might mislead us, suggesting rank-order or magnitude differences among values that do not exist!\n",
    "\n",
    "### Ordinal (O)\n",
    "\n",
    "*Ordinal* data consist of values that have a specific ordering.\n",
    "\n",
    "With ordinal data we can compare the rank-ordering of values: *does value A come before or after value B? (A < B)*, supporting statements like “A is less than B” or “A is greater than B”.\n",
    "In the dataset above, we can treat the `year` field as ordinal.\n",
    "\n",
    "When visualizing ordinal data, we should perceive a sense of rank-order. Position, size, or color value (brightness) might be appropriate, where as color hue (which is not perceptually ordered) would be less appropriate.\n",
    "\n",
    "### Quantitative (Q)\n",
    "\n",
    "With *quantitative* data we can measure numerical differences among values. There are multiple sub-types of quantitative data:\n",
    "\n",
    "For *interval* data we can measure the distance (interval) between points: *what is the distance to value A from value B? (A - B)*, supporting statements such as “A is 12 units away from B”.\n",
    "\n",
    "For *ratio* data the zero-point is meaningful and so we can also measure proportions or scale factors: *value A is what proportion of value B? (A / B)*, supporting statements such as “A is 10% of B” or “B is 7 times larger than A”.\n",
    "\n",
    "In the dataset above, `year` is a quantitative interval field (the value of year \"zero\" is subjective), whereas `fertility` and `life_expect` are quantitative ratio fields (zero is meaningful for calculating proportions).\n",
    "Vega-Lite represents quantitative data, but does not make a distinction between interval and ratio types.\n",
    "\n",
    "Quantitative values can be visualized using position, size, or color value, among other channels. An axis with a zero baseline is essential for proportional comparisons of ratio values, but can be safely omitted for interval comparisons.\n",
    "\n",
    "### Temporal (T)\n",
    "\n",
    "*Temporal* values measure time points or intervals. This type is a special case of quantitative values (timestamps) with rich semantics and conventions (i.e., the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar)). The temporal type in Vega-Lite supports reasoning about time units (year, month, day, hour, etc.), and provides methods for requesting specific time intervals.\n",
    "\n",
    "Example temporal values include date strings such as `“2019-01-04”` and `“Jan 04 2019”`, as well as standardized date-times such as the [ISO date-time format](https://en.wikipedia.org/wiki/ISO_8601): `“2019-01-04T17:50:35.643Z”`.\n",
    "\n",
    "There are no temporal values in our global development dataset above, as the `year` field is simply encoded as an integer. For more details about using temporal data in Altair, see the [Times and Dates documentation](https://altair-viz.github.io/user_guide/times_and_dates.html).\n",
    "\n",
    "### Summary\n",
    "\n",
    "These data types are not mutually exclusive, but rather form a hierarchy: ordinal data support nominal (equality) comparisons, while quantitative data support ordinal (rank-order) comparisons.\n",
    "\n",
    "Moreover, these data types do _not_ provide a fixed categorization. Just because a data field is represented using a number doesn't mean we have to treat it as a quantitative type! For example, we might interpret a set of ages (10 years old, 20 years old, etc) as nominal (underage or overage), ordinal (grouped by year), or quantitative (calculate average age).\n",
    "\n",
    "Now let's examine how to visually encode these data types!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "yaz3tS2RKf03"
   },
   "source": [
    "## Encoding Channels\n",
    "\n",
    "At the heart of Altair is the use of *encodings* that bind data fields (with a given data type) to available encoding *channels* of a chosen *mark* type. In this notebook we'll examine the following encoding channels:\n",
    "\n",
    "- `x`: Horizontal (x-axis) position of the mark.\n",
    "- `y`: Vertical (y-axis) position of the mark.\n",
    "- `size`: Size of the mark. May correspond to area or length, depending on the mark type.\n",
    "- `color`: Mark color, specified as a [legal CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).\n",
    "- `opacity`: Mark opacity, ranging from 0 (fully transparent) to 1 (fully opaque).\n",
    "- `shape`: Plotting symbol shape for `point` marks.\n",
    "- `tooltip`: Tooltip text to display upon mouse hover over the mark.\n",
    "- `order`: Mark ordering, determines line/area point order and drawing order.\n",
    "- `column`: Facet the data into horizontally-aligned subplots.\n",
    "- `row`: Facet the data into vertically-aligned subplots.\n",
    "\n",
    "For a complete list of available channels, see the [Altair encoding documentation](https://altair-viz.github.io/user_guide/encoding.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "vujZA4b6OCRC"
   },
   "source": [
    "### X\n",
    "\n",
    "The `x` encoding channel sets a mark's horizontal position (x-coordinate). In addition, default choices of axis and title are made automatically. In the chart below, the choice of a quantitative data type results in a continuous linear axis scale:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 87
    },
    "colab_type": "code",
    "id": "nswya-ToLaRP",
    "outputId": "2a958755-7f70-4a86-ab6f-2cfb24ad7231"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-93a08b470e32499ab9eedf39a5da2ebf\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-93a08b470e32499ab9eedf39a5da2ebf\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "WwQuuyKUOElr"
   },
   "source": [
    "### Y\n",
    "\n",
    "The `y` encoding channel sets a mark's vertical position (y-coordinate). Here we've added the `cluster` field using an ordinal (`O`) data type. The result is a discrete axis that includes a sized band, with a default step size, for each unique value:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "eP38vNrdNrHF",
    "outputId": "9ff5b4a8-143c-4595-845f-026ed2e747a8"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-9ef01cf9e1c443fab663958e9af7d9ff\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-9ef01cf9e1c443fab663958e9af7d9ff\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"ordinal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:O')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "2BQetZgvc0f_"
   },
   "source": [
    "_What happens to the chart above if you swap the `O` and `Q` field types?_\n",
    "\n",
    "If we instead add the `life_expect` field as a quantitative (`Q`) variable, the result is a scatter plot with linear scales for both axes:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "n8PJhH6jN68w",
    "outputId": "ac41eaeb-4872-48db-ddf1-ab6b5c84f387"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-ca14ccc927d64bf7bd875fa20329d14f\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-ca14ccc927d64bf7bd875fa20329d14f\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "GUKc1DEDTbA0"
   },
   "source": [
    "By default, axes for linear quantitative scales include zero to ensure a proper baseline for comparing ratio-valued data. In some cases, however, a zero baseline may be meaningless or you may want to focus on interval comparisons. To disable automatic inclusion of zero, configure the scale mapping using the encoding `scale` attribute:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "-6klI5DhSdik",
    "outputId": "8cb0ca55-176b-4d2f-8891-2c124276e429"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-d158de75e4854c61a15e282b2b4ba936\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-d158de75e4854c61a15e282b2b4ba936\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"field\": \"fertility\", \"scale\": {\"zero\": false}}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\", \"scale\": {\"zero\": false}}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q', scale=alt.Scale(zero=False)),\n",
    "    alt.Y('life_expect:Q', scale=alt.Scale(zero=False))\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "oUKf6WQmSzqC"
   },
   "source": [
    "Now the axis scales no longer include zero by default. Some padding still remains, as the axis domain end points are automatically snapped to _nice_ numbers like multiples of 5 or 10.\n",
    "\n",
    "_What happens if you also add `nice=False` to the scale attribute above?_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "hKCsQ0iIPMTV"
   },
   "source": [
    "### Size"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "G7YtT-HNdYT9"
   },
   "source": [
    "The `size` encoding channel sets a mark's size or extent. The meaning of the channel can vary based on the mark type. For `point` marks, the `size` channel maps to the pixel area of the plotting symbol, such that the diameter of the point matches the square root of the size value.\n",
    "\n",
    "Let's augment our scatter plot by encoding population (`pop`) on the `size` channel. As a result, the chart now also includes a legend for interpreting the size values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "sGENuXRfOIPz",
    "outputId": "4f76557c-4e35-41fc-9e06-513be34969ae"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-9c9eb8d30d42494cba17b5a595d26646\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-9c9eb8d30d42494cba17b5a595d26646\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"size\": {\"type\": \"quantitative\", \"field\": \"pop\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "g5Cu5F2Ad9xG"
   },
   "source": [
    "In some cases we might be unsatisfied with the default size range. To provide a customized span of sizes, set the `range` parameter of the `scale` attribute to an array indicating the smallest and largest sizes. Here we update the size encoding to range from 0 pixels (for zero values) to 1,000 pixels (for the maximum value in the scale domain):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "cALgZSQfQzi0",
    "outputId": "0d88f561-9737-43fa-a84a-7ad6dcdfbf0c"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-b0d78bd55617413881067ada40eb8e4a\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-b0d78bd55617413881067ada40eb8e4a\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000]))\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "yF__0zZ0PJyT"
   },
   "source": [
    "### Color and Opacity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "u5QXPLxJeohH"
   },
   "source": [
    "The `color` encoding channel sets a mark's color. The style of color encoding is highly dependent on the data type: nominal data will default to a multi-hued qualitative color scheme, whereas ordinal and quantitative data will use perceptually ordered color gradients.\n",
    "\n",
    "Here, we encode the `cluster` field using the `color` channel and a nominal (`N`) data type, resulting in a distinct hue for each cluster value. Can you start to guess what the `cluster` field might indicate?\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "bI73XTt5OTmA",
    "outputId": "f12aeb57-07c5-422e-8cb1-62253b545af8"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-06303a311551449598448bb3f0d0452b\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-06303a311551449598448bb3f0d0452b\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "dNOkUJfNfFac"
   },
   "source": [
    "If we prefer filled shapes, we can can pass a `filled=True` parameter to the `mark_point` method:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "HH34VMCAQO6s",
    "outputId": "8aba4f13-bfe3-43b1-e3ea-554a8d20b7f5"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-4cabad8187eb42ea8cd7894fc5d111db\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-4cabad8187eb42ea8cd7894fc5d111db\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "YY96rt7zfRYG"
   },
   "source": [
    "By default, Altair uses a bit of transparency to help combat over-plotting. We are free to further adjust the opacity, either by passing a default value to the `mark_*` method, or using a dedicated encoding channel.\n",
    "\n",
    "Here we demonstrate how to provide a constant value to an encoding channel instead of binding a data field:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "42kM5nuDOfGm",
    "outputId": "2dd14842-8fd5-4997-ea47-91cd489e0193"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-f3ff2875103f4302944c193447f06194\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-f3ff2875103f4302944c193447f06194\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5)\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "zW2Siu5sPaiE"
   },
   "source": [
    "### Shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "MGM2hdOqf3Tu"
   },
   "source": [
    "The `shape` encoding channel sets the geometric shape used by `point` marks. Unlike the other channels we have seen so far, the `shape` channel can not be used by other mark types. The shape encoding channel should only be used with nominal data, as perceptual rank-order and magnitude comparisons are not supported.\n",
    "\n",
    "Let's encode the `cluster` field using `shape` as well as `color`. Using multiple channels for the same underlying data field is known as a *redundant encoding*. The resulting chart combines both color and shape information into a single symbol legend:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "czAIeWjSPS5x",
    "outputId": "e418f006-988c-42a9-9a81-664d1d52d93c"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-4222bccd2fd14e6889adb9d6f124631c\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-4222bccd2fd14e6889adb9d6f124631c\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "ramTzfIgUtEi"
   },
   "source": [
    "### Tooltips & Ordering"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "VE-29r8dg1Us"
   },
   "source": [
    "By this point, you might feel a bit frustrated: we've built up a chart, but we still don't know what countries the visualized points correspond to! Let's add interactive tooltips to enable exploration.\n",
    "\n",
    "The `tooltip` encoding channel determines tooltip text to show when a user moves the mouse cursor over a mark. Let's add a tooltip encoding for the `country` field, then investigate which countries are being represented.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "61evgaeFUyU0",
    "outputId": "f13ddd14-3b6f-4f96-ca08-8d3b2ba94a34"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-c983799358fd4d0ea48341e9dd5de17e\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-c983799358fd4d0ea48341e9dd5de17e\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Tooltip('country')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "IRexn5IAhgeW"
   },
   "source": [
    "As you mouse around you may notice that you can not select some of the points. For example, the largest dark blue circle corresponds to India, which is drawn on top of a country with a smaller population, preventing the mouse from hovering over that country. To fix this problem, we can use the `order` encoding channel.\n",
    "\n",
    "The `order` encoding channel determines the order of data points, affecting both the order in which they are drawn and, for `line` and `area` marks, the order in which they are connected to one another.\n",
    "\n",
    "Let's order the values in descending rank order by the population (`pop`), ensuring that smaller circles are drawn later than larger circles:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "DywIzwtgVD3Z",
    "outputId": "3b7254de-09f3-4850-f066-ea8318ec5479"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-e4dd33c0de1b4894ba12b1445772ba42\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-e4dd33c0de1b4894ba12b1445772ba42\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"order\": {\"type\": \"quantitative\", \"field\": \"pop\", \"sort\": \"descending\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Tooltip('country:N'),\n",
    "    alt.Order('pop:Q', sort='descending')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "Ei93j-daiG6U"
   },
   "source": [
    "Now we can identify the smaller country being obscured by India: it's Bangladesh!\n",
    "\n",
    "We can also now figure out what the `cluster` field represents. Mouse over the various colored points to formulate your own explanation."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "9bsu1tn_idGt"
   },
   "source": [
    "At this point we've added tooltips that show only a single property of the underlying data record. To show multiple values, we can provide the `tooltip` channel an array of encodings, one for each field we want to include:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 372
    },
    "colab_type": "code",
    "id": "450DUk-mXzzQ",
    "outputId": "ee47eb3b-146d-4c6b-dfa7-94ddeb0fc5d3"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-e4a0c918b4354597b688c4c32db9445a\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-e4a0c918b4354597b688c4c32db9445a\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"order\": {\"type\": \"quantitative\", \"field\": \"pop\", \"sort\": \"descending\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"country\"}, {\"type\": \"quantitative\", \"field\": \"fertility\"}, {\"type\": \"quantitative\", \"field\": \"life_expect\"}], \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Order('pop:Q', sort='descending'),\n",
    "    tooltip = [\n",
    "        alt.Tooltip('country:N'),\n",
    "        alt.Tooltip('fertility:Q'),\n",
    "        alt.Tooltip('life_expect:Q')\n",
    "    ]   \n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "HLQjhEdwiyR2"
   },
   "source": [
    "Now we can see multiple data fields upon mouse over!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "5ViS2LDKRmil"
   },
   "source": [
    "### Column and Row Facets"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "apPtlcDoi3yT"
   },
   "source": [
    "Spatial position is one of the most powerful and flexible channels for visual encoding, but what can we do if we already have assigned fields to the `x` and `y` channels? One valuable technique is to create a *trellis plot*, consisting of sub-plots that show a subset of the data. A trellis plot is one example of the more general technique of presenting data using [small multiples](https://en.wikipedia.org/wiki/Small_multiple) of views.\n",
    "\n",
    "The `column` and `row` encoding channels generate either a horizontal (columns) or vertical (rows) set of sub-plots, in which the data is partitioned according to the provided data field.\n",
    "\n",
    "Here is a trellis plot that divides the data into one column per \\`cluster\\` value:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 441
    },
    "colab_type": "code",
    "id": "gszjktorPmRc",
    "outputId": "b62aff8e-a2aa-409a-be1d-4cf3708f9ab3"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-d499282ffebe44c89aa742b3d046d26d\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-d499282ffebe44c89aa742b3d046d26d\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"column\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"order\": {\"type\": \"quantitative\", \"field\": \"pop\", \"sort\": \"descending\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"range\": [0, 1000]}}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000])),\n",
    "    alt.Color('cluster:N'),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Tooltip('country:N'),\n",
    "    alt.Order('pop:Q', sort='descending'),\n",
    "    alt.Column('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "8J0dxQoFj9jw"
   },
   "source": [
    "The plot above does not fit on screen, making it difficult to compare all the sub-plots to each other! We can set the default `width` and `height` properties to create a smaller set of multiples. Also, as the column headers already label the `cluster` values, let's remove our `color` legend by setting it to `None`. To make better use of space we can also orient our `size` legend to the `'bottom'` of the chart."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 321
    },
    "colab_type": "code",
    "id": "PvKBL59lRrc_",
    "outputId": "3eb84b63-0c69-4985-ee9b-d0d69e5ffb33"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-c17e0e3b7e1a42c3b1b32b3edf52f070\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-c17e0e3b7e1a42c3b1b32b3edf52f070\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\", \"legend\": null}, \"column\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"opacity\": {\"value\": 0.5}, \"order\": {\"type\": \"quantitative\", \"field\": \"pop\", \"sort\": \"descending\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"legend\": {\"orient\": \"bottom\", \"titleOrient\": \"left\"}, \"scale\": {\"range\": [0, 1000]}}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\"}}, \"height\": 135, \"width\": 135, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('life_expect:Q'),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(range=[0,1000]),\n",
    "             legend=alt.Legend(orient='bottom', titleOrient='left')),\n",
    "    alt.Color('cluster:N', legend=None),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Tooltip('country:N'),\n",
    "    alt.Order('pop:Q', sort='descending'),\n",
    "    alt.Column('cluster:N')\n",
    ").properties(width=135, height=135)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "OmQmca9WkKOU"
   },
   "source": [
    "Underneath the hood, the `column` and `row` encodings are translated into a new specification that uses the `facet` view composition operator. We will re-visit faceting in greater depth later on!\n",
    "\n",
    "In the meantime, _can you rewrite the chart above to facet into rows instead of columns?_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "-tZXDmLjbAu5"
   },
   "source": [
    "### A Peek Ahead: Interactive Filtering\n",
    "\n",
    "In later modules, we'll dive into interaction techniques for data exploration. Here is a sneak peak: binding a range slider to the `year` field to enable interactive scrubbing through each year of data. Don't worry if the code below is a bit confusing at this point, as we will cover interaction in detail later.\n",
    "\n",
    "_Drag the slider back and forth to see how the data values change over time!_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 393
    },
    "colab_type": "code",
    "id": "6kQLe1wqZPub",
    "outputId": "3c934853-9167-4ad1-e560-b366250eb40e"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-136867391afb41b9a9ee03641af6819d\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-136867391afb41b9a9ee03641af6819d\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-89be1acdd14c7effd56f4dd0fabf92c3\"}, \"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"cluster\", \"legend\": null}, \"opacity\": {\"value\": 0.5}, \"order\": {\"type\": \"quantitative\", \"field\": \"pop\", \"sort\": \"descending\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"pop\", \"scale\": {\"domain\": [0, 1200000000], \"range\": [0, 1000]}}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\", \"scale\": {\"domain\": [0, 9]}}, \"y\": {\"type\": \"quantitative\", \"field\": \"life_expect\", \"scale\": {\"domain\": [0, 90]}}}, \"selection\": {\"select\": {\"type\": \"single\", \"fields\": [\"year\"], \"init\": {\"year\": 1955}, \"bind\": {\"input\": \"range\", \"max\": 2005, \"min\": 1955, \"step\": 5}}}, \"transform\": [{\"filter\": {\"selection\": \"select\"}}], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-89be1acdd14c7effd56f4dd0fabf92c3\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 30.332, \"pop\": 8891209, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 31.997, \"pop\": 9829450, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 34.02, \"pop\": 10997885, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 36.088, \"pop\": 12430623, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 38.438, \"pop\": 14132019, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.8, \"life_expect\": 39.854, \"pop\": 15112149, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.9, \"life_expect\": 40.822, \"pop\": 13796928, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.674, \"pop\": 14669339, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.763, \"pop\": 20881480, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.0685, \"life_expect\": 43.828, \"pop\": 29928987, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1265, \"life_expect\": 64.399, \"pop\": 18927821, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.0895, \"life_expect\": 65.142, \"pop\": 20616009, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.049, \"life_expect\": 65.634, \"pop\": 22283100, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1455, \"life_expect\": 67.065, \"pop\": 23962313, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.44, \"life_expect\": 68.481, \"pop\": 26081880, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.15, \"life_expect\": 69.942, \"pop\": 28369799, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.053, \"life_expect\": 70.774, \"pop\": 30675059, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.9, \"life_expect\": 71.868, \"pop\": 33022202, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.63, \"life_expect\": 73.275, \"pop\": 35311049, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.254, \"life_expect\": 75.32, \"pop\": 39537943, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 5.15, \"life_expect\": 64.381, \"pop\": 53865, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 4.399, \"life_expect\": 66.606, \"pop\": 57203, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 3.301, \"life_expect\": 68.336, \"pop\": 59020, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.651, \"life_expect\": 70.941, \"pop\": 59039, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.45, \"life_expect\": 71.83, \"pop\": 59390, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.358, \"life_expect\": 74.116, \"pop\": 60266, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.3, \"life_expect\": 74.494, \"pop\": 64129, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.2800000000000002, \"life_expect\": 74.108, \"pop\": 66653, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.208, \"life_expect\": 73.011, \"pop\": 67836, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.04, \"life_expect\": 74.239, \"pop\": 71566, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.406, \"life_expect\": 70.33, \"pop\": 9277087, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.274, \"life_expect\": 70.93, \"pop\": 10361273, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.871, \"life_expect\": 71.1, \"pop\": 11439384, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.535, \"life_expect\": 71.93, \"pop\": 12660160, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.9889999999999999, \"life_expect\": 73.49, \"pop\": 13771400, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.907, \"life_expect\": 74.74, \"pop\": 14615900, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.859, \"life_expect\": 76.32, \"pop\": 15788300, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.8599999999999999, \"life_expect\": 77.56, \"pop\": 17022133, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.776, \"life_expect\": 78.83, \"pop\": 18116171, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.788, \"life_expect\": 81.235, \"pop\": 20090437, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.52, \"life_expect\": 67.48, \"pop\": 6946885, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.7800000000000002, \"life_expect\": 69.54, \"pop\": 7047437, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.5300000000000002, \"life_expect\": 70.14, \"pop\": 7270889, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.02, \"life_expect\": 70.63, \"pop\": 7467086, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.6400000000000001, \"life_expect\": 72.17, \"pop\": 7578903, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.62, \"life_expect\": 73.18, \"pop\": 7549433, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.45, \"life_expect\": 74.94, \"pop\": 7559776, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.47, \"life_expect\": 76.04, \"pop\": 7722953, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.388, \"life_expect\": 77.51, \"pop\": 8047433, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.42, \"life_expect\": 79.829, \"pop\": 8184691, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.305, \"life_expect\": 62.405, \"pop\": 87138, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.503, \"life_expect\": 64.209, \"pop\": 112234, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.794, \"life_expect\": 65.795, \"pop\": 139205, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.444, \"life_expect\": 66.515, \"pop\": 170323, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.221, \"life_expect\": 67.199, \"pop\": 189139, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.16, \"life_expect\": 67.874, \"pop\": 209944, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.62, \"life_expect\": 69.524, \"pop\": 234988, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.6, \"life_expect\": 69.171, \"pop\": 257253, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.4, \"life_expect\": 68.472, \"pop\": 275303, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.0221, \"life_expect\": 73.495, \"pop\": 301790, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.76, \"life_expect\": 39.348, \"pop\": 49601520, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.85, \"life_expect\": 41.216, \"pop\": 54621538, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.6, \"life_expect\": 43.453, \"pop\": 60332117, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.15, \"life_expect\": 45.252, \"pop\": 67402621, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.6, \"life_expect\": 46.923, \"pop\": 76253310, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.25, \"life_expect\": 50.009, \"pop\": 88076996, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.629, \"life_expect\": 52.819, \"pop\": 99752733, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.117, \"life_expect\": 56.018, \"pop\": 109896945, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.5042999999999997, \"life_expect\": 59.412, \"pop\": 119186448, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 2.826, \"life_expect\": 64.062, \"pop\": 144319628, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.67, \"life_expect\": 62.57, \"pop\": 227255, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.26, \"life_expect\": 65.87, \"pop\": 232339, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 3.45, \"life_expect\": 67.62, \"pop\": 234980, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.74, \"life_expect\": 69.42, \"pop\": 238756, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.19, \"life_expect\": 71.27, \"pop\": 247147, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.92, \"life_expect\": 72.695, \"pop\": 251966, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.75, \"life_expect\": 74.027, \"pop\": 257446, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.6, \"life_expect\": 74.894, \"pop\": 262624, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 74.912, \"pop\": 267907, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 77.296, \"pop\": 278870, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.496, \"life_expect\": 69.24, \"pop\": 8868475, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.644, \"life_expect\": 70.25, \"pop\": 9118700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.392, \"life_expect\": 70.94, \"pop\": 9448100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.015, \"life_expect\": 71.44, \"pop\": 9637800, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.705, \"life_expect\": 72.8, \"pop\": 9794800, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.595, \"life_expect\": 73.93, \"pop\": 9846800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.5590000000000002, \"life_expect\": 75.35, \"pop\": 9858200, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.613, \"life_expect\": 76.46, \"pop\": 9969310, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.604, \"life_expect\": 77.53, \"pop\": 10155459, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.646, \"life_expect\": 79.441, \"pop\": 10364388, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.75, \"life_expect\": 41.89, \"pop\": 3074311, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.63, \"life_expect\": 43.428, \"pop\": 3434073, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5600000000000005, \"life_expect\": 45.032, \"pop\": 3853315, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5, \"life_expect\": 46.714, \"pop\": 4346218, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.8, \"life_expect\": 50.023, \"pop\": 4914316, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.2995, \"life_expect\": 53.859, \"pop\": 5441298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.0, \"life_expect\": 57.251, \"pop\": 5934935, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.8, \"life_expect\": 59.957, \"pop\": 6573900, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.324, \"life_expect\": 62.05, \"pop\": 7376582, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.5, \"life_expect\": 65.554, \"pop\": 8857870, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 53.285, \"pop\": 61773546, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 55.665, \"pop\": 71694810, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 5.38, \"life_expect\": 57.632, \"pop\": 83092908, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.7175, \"life_expect\": 59.504, \"pop\": 95684297, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.305, \"life_expect\": 61.489, \"pop\": 108823732, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.8, \"life_expect\": 63.336, \"pop\": 122958132, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.1, \"life_expect\": 65.205, \"pop\": 137302933, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.6, \"life_expect\": 67.057, \"pop\": 151083809, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.45, \"life_expect\": 69.388, \"pop\": 163542501, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.245, \"life_expect\": 72.39, \"pop\": 186112794, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.486, \"life_expect\": 56.074, \"pop\": 6743269, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.4385, \"life_expect\": 57.924, \"pop\": 7585349, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 4.4405, \"life_expect\": 60.523, \"pop\": 8509950, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 3.63, \"life_expect\": 63.441, \"pop\": 9368558, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.803, \"life_expect\": 67.052, \"pop\": 10251542, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.6710000000000003, \"life_expect\": 70.565, \"pop\": 11093718, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.65, \"life_expect\": 72.492, \"pop\": 12066701, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.55, \"life_expect\": 74.126, \"pop\": 13127760, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.21, \"life_expect\": 75.816, \"pop\": 14205449, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 1.944, \"life_expect\": 78.553, \"pop\": 15980912, \"year\": 2005}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.59, \"life_expect\": 50.54896, \"pop\": 608655000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.72, \"life_expect\": 44.50136, \"pop\": 667070000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 6.06, \"life_expect\": 58.38112, \"pop\": 715185000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 4.86, \"life_expect\": 63.11888, \"pop\": 818315000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 3.32, \"life_expect\": 63.96736, \"pop\": 916395000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.55, \"life_expect\": 65.525, \"pop\": 981235000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.46, \"life_expect\": 67.274, \"pop\": 1051040000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.92, \"life_expect\": 68.69, \"pop\": 1135185000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7810000000000001, \"life_expect\": 70.426, \"pop\": 1204855000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.725, \"life_expect\": 72.961, \"pop\": 1303182268, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 55.118, \"pop\": 13588405, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 57.863, \"pop\": 15952727, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.18, \"life_expect\": 59.963, \"pop\": 18646175, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 5.0005, \"life_expect\": 61.623, \"pop\": 21429658, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 4.3385, \"life_expect\": 63.837, \"pop\": 24114177, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.685, \"life_expect\": 66.653, \"pop\": 26582811, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.172, \"life_expect\": 67.768, \"pop\": 29678395, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.93005, \"life_expect\": 68.421, \"pop\": 32858579, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.7, \"life_expect\": 70.313, \"pop\": 36280883, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.2205, \"life_expect\": 72.889, \"pop\": 42954279, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.1135, \"life_expect\": 60.026, \"pop\": 1031782, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.2245, \"life_expect\": 62.842, \"pop\": 1248022, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 5.801, \"life_expect\": 65.424, \"pop\": 1487605, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 4.346, \"life_expect\": 67.849, \"pop\": 1735523, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.7755, \"life_expect\": 70.75, \"pop\": 1991580, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.527, \"life_expect\": 73.45, \"pop\": 2299124, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.374, \"life_expect\": 74.752, \"pop\": 2643808, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.9450000000000003, \"life_expect\": 75.713, \"pop\": 3027175, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.5835, \"life_expect\": 77.26, \"pop\": 3383786, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.0985, \"life_expect\": 78.782, \"pop\": 4016173, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.42, \"life_expect\": 64.77, \"pop\": 3955526, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.27, \"life_expect\": 67.13, \"pop\": 4036145, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.09, \"life_expect\": 68.5, \"pop\": 4133313, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 69.61, \"pop\": 4205389, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.02, \"life_expect\": 70.64, \"pop\": 4255000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 70.46, \"pop\": 4383000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.8399999999999999, \"life_expect\": 71.52, \"pop\": 4457874, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.52, \"life_expect\": 72.527, \"pop\": 4508347, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.537, \"life_expect\": 73.68, \"pop\": 4496683, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.346, \"life_expect\": 75.748, \"pop\": 4495904, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6995, \"life_expect\": 62.325, \"pop\": 6381106, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.6805, \"life_expect\": 65.246, \"pop\": 7027210, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.3, \"life_expect\": 68.29, \"pop\": 7809916, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6, \"life_expect\": 70.723, \"pop\": 8542746, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 2.15, \"life_expect\": 72.649, \"pop\": 9290074, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 73.717, \"pop\": 9652975, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 74.174, \"pop\": 10078658, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6505, \"life_expect\": 74.414, \"pop\": 10544793, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6095000000000002, \"life_expect\": 76.151, \"pop\": 10896802, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.49, \"life_expect\": 78.273, \"pop\": 11346670, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.6405, \"life_expect\": 49.828, \"pop\": 2737257, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.3505, \"life_expect\": 53.459, \"pop\": 3231488, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 6.6495, \"life_expect\": 56.751, \"pop\": 3805881, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 5.71, \"life_expect\": 59.631, \"pop\": 4422755, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.76, \"life_expect\": 61.788, \"pop\": 5048499, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.0, \"life_expect\": 63.727, \"pop\": 5696855, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.47, \"life_expect\": 66.046, \"pop\": 6377765, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.1995, \"life_expect\": 68.457, \"pop\": 7077651, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.05, \"life_expect\": 69.957, \"pop\": 7730224, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.81, \"life_expect\": 72.235, \"pop\": 9049595, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 51.356, \"pop\": 3842399, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 54.64, \"pop\": 4415956, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.5, \"life_expect\": 56.678, \"pop\": 5117779, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.0005, \"life_expect\": 58.796, \"pop\": 5939246, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 5.4005, \"life_expect\": 61.31, \"pop\": 6871698, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.7005, \"life_expect\": 64.342, \"pop\": 7920499, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.0, \"life_expect\": 67.231, \"pop\": 9061664, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.4005, \"life_expect\": 69.613, \"pop\": 10318036, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.1, \"life_expect\": 72.312, \"pop\": 11438004, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.578, \"life_expect\": 74.994, \"pop\": 13363593, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.97, \"life_expect\": 44.444, \"pop\": 23855527, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 7.073, \"life_expect\": 46.992, \"pop\": 26846610, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.5600000000000005, \"life_expect\": 49.293, \"pop\": 30265148, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.855, \"life_expect\": 51.137, \"pop\": 33574026, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.609, \"life_expect\": 53.319, \"pop\": 36952499, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.332, \"life_expect\": 56.006, \"pop\": 42634215, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 4.833, \"life_expect\": 59.797, \"pop\": 50052381, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.908, \"life_expect\": 63.674, \"pop\": 56694413, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.5, \"life_expect\": 67.217, \"pop\": 63321615, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 2.891, \"life_expect\": 71.338, \"pop\": 77505756, \"year\": 2005}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8065, \"life_expect\": 48.57, \"pop\": 2221139, \"year\": 1955}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8469999999999995, \"life_expect\": 52.307, \"pop\": 2581583, \"year\": 1960}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.621, \"life_expect\": 55.855, \"pop\": 3017852, \"year\": 1965}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.0995, \"life_expect\": 58.207, \"pop\": 3603907, \"year\": 1970}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 5.5996, \"life_expect\": 56.696, \"pop\": 4071179, \"year\": 1975}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 4.5, \"life_expect\": 56.604, \"pop\": 4566199, \"year\": 1980}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.901, \"life_expect\": 63.154, \"pop\": 4664361, \"year\": 1985}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.52, \"life_expect\": 66.798, \"pop\": 5099884, \"year\": 1990}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.17, \"life_expect\": 69.535, \"pop\": 5568437, \"year\": 1995}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.6825, \"life_expect\": 71.878, \"pop\": 6704932, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.769, \"life_expect\": 67.49, \"pop\": 4234900, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.66, \"life_expect\": 68.75, \"pop\": 4429600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.191, \"life_expect\": 69.83, \"pop\": 4563732, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.623, \"life_expect\": 70.87, \"pop\": 4606307, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.663, \"life_expect\": 72.52, \"pop\": 4711439, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.685, \"life_expect\": 74.55, \"pop\": 4779535, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.6600000000000001, \"life_expect\": 74.83, \"pop\": 4901783, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.819, \"life_expect\": 75.7, \"pop\": 4986431, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.7429999999999999, \"life_expect\": 77.13, \"pop\": 5104654, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.8250000000000002, \"life_expect\": 79.313, \"pop\": 5223442, \"year\": 2005}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.7119999999999997, \"life_expect\": 68.93, \"pop\": 43427669, \"year\": 1955}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.85, \"life_expect\": 70.51, \"pop\": 45670000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.607, \"life_expect\": 71.55, \"pop\": 48763000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.31, \"life_expect\": 72.38, \"pop\": 50787000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.862, \"life_expect\": 73.83, \"pop\": 52758427, \"year\": 1975}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.866, \"life_expect\": 74.89, \"pop\": 53869743, \"year\": 1980}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8050000000000002, \"life_expect\": 76.34, \"pop\": 55171224, \"year\": 1985}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.713, \"life_expect\": 77.46, \"pop\": 56735161, \"year\": 1990}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.7624, \"life_expect\": 78.64, \"pop\": 58149727, \"year\": 1995}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8916, \"life_expect\": 80.657, \"pop\": 60656178, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.909, \"life_expect\": 62.625, \"pop\": 3827154, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.979, \"life_expect\": 64.644, \"pop\": 4146570, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.6109999999999998, \"life_expect\": 66.654, \"pop\": 4464959, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.601, \"life_expect\": 68.158, \"pop\": 4694491, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.39, \"life_expect\": 69.634, \"pop\": 4897656, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.269, \"life_expect\": 69.638, \"pop\": 5045697, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.263, \"life_expect\": 70.45, \"pop\": 5192957, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.9500000000000002, \"life_expect\": 70.465, \"pop\": 5426207, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.58, \"life_expect\": 70.49, \"pop\": 5012952, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.407, \"life_expect\": 70.987, \"pop\": 4677401, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.3, \"life_expect\": 69.1, \"pop\": 70195612, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.49, \"life_expect\": 70.3, \"pop\": 72480869, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.32, \"life_expect\": 70.8, \"pop\": 75638851, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.6400000000000001, \"life_expect\": 71.0, \"pop\": 77783164, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.52, \"life_expect\": 72.5, \"pop\": 78682325, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.46, \"life_expect\": 73.8, \"pop\": 78297904, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.43, \"life_expect\": 74.847, \"pop\": 77684907, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.31, \"life_expect\": 76.07, \"pop\": 79380394, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.34, \"life_expect\": 77.34, \"pop\": 81653702, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.3599999999999999, \"life_expect\": 79.406, \"pop\": 82431390, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.27, \"life_expect\": 67.86, \"pop\": 7965538, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.2, \"life_expect\": 69.51, \"pop\": 8327405, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.38, \"life_expect\": 71.0, \"pop\": 8550333, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 72.34, \"pop\": 8792806, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 73.68, \"pop\": 9046542, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.96, \"life_expect\": 75.24, \"pop\": 9642505, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.53, \"life_expect\": 76.67, \"pop\": 9923253, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.37, \"life_expect\": 77.03, \"pop\": 10129603, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.296, \"life_expect\": 77.869, \"pop\": 10457554, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.325, \"life_expect\": 79.483, \"pop\": 10668354, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.7, \"life_expect\": 63.114, \"pop\": 84621, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.4, \"life_expect\": 63.608, \"pop\": 90148, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.8, \"life_expect\": 64.091, \"pop\": 93290, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.6, \"life_expect\": 64.577, \"pop\": 95410, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.3, \"life_expect\": 65.035, \"pop\": 95819, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.23, \"life_expect\": 65.503, \"pop\": 90164, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.14, \"life_expect\": 66.002, \"pop\": 92203, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 3.26, \"life_expect\": 66.469, \"pop\": 92360, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.814, \"life_expect\": 66.986, \"pop\": 90603, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.302, \"life_expect\": 68.724, \"pop\": 89502, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 40.696, \"pop\": 3376419, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 43.59, \"pop\": 3722743, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.0, \"life_expect\": 46.243, \"pop\": 4137405, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.6005, \"life_expect\": 48.042, \"pop\": 4604915, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.8, \"life_expect\": 49.923, \"pop\": 4828338, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.2099, \"life_expect\": 51.461, \"pop\": 5029725, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.69985, \"life_expect\": 53.636, \"pop\": 5517977, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.14985, \"life_expect\": 55.089, \"pop\": 6126101, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.61995, \"life_expect\": 56.671, \"pop\": 6675578, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 3.5445, \"life_expect\": 60.916, \"pop\": 8121622, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.72, \"life_expect\": 64.75, \"pop\": 2490400, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 5.31, \"life_expect\": 67.65, \"pop\": 3075300, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.02, \"life_expect\": 70.0, \"pop\": 3597900, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.89, \"life_expect\": 72.0, \"pop\": 3959000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.32, \"life_expect\": 73.6, \"pop\": 4395800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.8, \"life_expect\": 75.45, \"pop\": 5063100, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.31, \"life_expect\": 76.2, \"pop\": 5456200, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.288, \"life_expect\": 77.601, \"pop\": 5687959, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.08, \"life_expect\": 80.0, \"pop\": 6225347, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.966, \"life_expect\": 82.208, \"pop\": 6898686, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 4.023, \"life_expect\": 73.47, \"pop\": 158044, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.943, \"life_expect\": 73.68, \"pop\": 175860, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.154, \"life_expect\": 73.73, \"pop\": 192288, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.843, \"life_expect\": 74.46, \"pop\": 204104, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.287, \"life_expect\": 76.11, \"pop\": 218031, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.248, \"life_expect\": 76.99, \"pop\": 228161, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.116, \"life_expect\": 77.23, \"pop\": 241403, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.194, \"life_expect\": 78.77, \"pop\": 254719, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.056, \"life_expect\": 78.95, \"pop\": 267527, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.052, \"life_expect\": 81.757, \"pop\": 296737, \"year\": 2005}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8961, \"life_expect\": 40.249, \"pop\": 393000000, \"year\": 1955}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8216, \"life_expect\": 43.605, \"pop\": 434000000, \"year\": 1960}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.6058, \"life_expect\": 47.193, \"pop\": 485000000, \"year\": 1965}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.264, \"life_expect\": 50.651, \"pop\": 541000000, \"year\": 1970}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.8888, \"life_expect\": 54.208, \"pop\": 607000000, \"year\": 1975}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.4975, \"life_expect\": 56.596, \"pop\": 679000000, \"year\": 1980}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.15, \"life_expect\": 58.553, \"pop\": 755000000, \"year\": 1985}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.8648, \"life_expect\": 60.223, \"pop\": 839000000, \"year\": 1990}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.4551, \"life_expect\": 61.765, \"pop\": 927000000, \"year\": 1995}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 2.8073, \"life_expect\": 64.698, \"pop\": 1080264388, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.672, \"life_expect\": 39.918, \"pop\": 86807000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.62, \"life_expect\": 42.518, \"pop\": 95254000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.568, \"life_expect\": 45.964, \"pop\": 105093000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.3, \"life_expect\": 49.203, \"pop\": 116044000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.73, \"life_expect\": 52.702, \"pop\": 130297000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.109, \"life_expect\": 56.159, \"pop\": 146995000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 3.4, \"life_expect\": 60.137, \"pop\": 163403000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.9, \"life_expect\": 62.681, \"pop\": 178500000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.55, \"life_expect\": 66.041, \"pop\": 194755000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.182, \"life_expect\": 70.65, \"pop\": 218465000, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 47.181, \"pop\": 18729000, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 49.325, \"pop\": 21577000, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.8, \"life_expect\": 52.469, \"pop\": 25000000, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.4, \"life_expect\": 55.234, \"pop\": 28933000, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.5, \"life_expect\": 57.702, \"pop\": 33379000, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.63, \"life_expect\": 59.62, \"pop\": 39583397, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 5.62, \"life_expect\": 63.04, \"pop\": 48439952, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 4.328, \"life_expect\": 65.742, \"pop\": 57035717, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.534, \"life_expect\": 68.042, \"pop\": 61628116, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.04, \"life_expect\": 70.964, \"pop\": 68017860, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.3, \"life_expect\": 48.437, \"pop\": 5903253, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.25, \"life_expect\": 51.457, \"pop\": 6822030, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.2, \"life_expect\": 54.459, \"pop\": 7970746, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.15, \"life_expect\": 56.95, \"pop\": 9413671, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.8, \"life_expect\": 60.413, \"pop\": 11117804, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.35, \"life_expect\": 62.038, \"pop\": 13232839, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.15, \"life_expect\": 65.044, \"pop\": 15693620, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.7, \"life_expect\": 59.461, \"pop\": 18134702, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.37, \"life_expect\": 58.811, \"pop\": 19557247, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.264, \"life_expect\": 59.545, \"pop\": 26074906, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.68, \"life_expect\": 68.9, \"pop\": 2916133, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.979, \"life_expect\": 70.29, \"pop\": 2832000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.873, \"life_expect\": 71.08, \"pop\": 2876000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.815, \"life_expect\": 71.28, \"pop\": 2950100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.478, \"life_expect\": 72.03, \"pop\": 3177300, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.877, \"life_expect\": 73.1, \"pop\": 3401000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.287, \"life_expect\": 74.36, \"pop\": 3540000, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 75.467, \"pop\": 3508200, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9, \"life_expect\": 76.122, \"pop\": 3613890, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.964, \"life_expect\": 78.885, \"pop\": 4015676, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.893, \"life_expect\": 67.84, \"pop\": 1772032, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.852, \"life_expect\": 69.39, \"pop\": 2141495, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.79, \"life_expect\": 70.75, \"pop\": 2578184, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.77, \"life_expect\": 71.63, \"pop\": 2903434, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.409, \"life_expect\": 73.06, \"pop\": 3354242, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.125, \"life_expect\": 74.45, \"pop\": 3737473, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.051, \"life_expect\": 75.6, \"pop\": 4074965, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.933, \"life_expect\": 76.93, \"pop\": 4512068, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.942, \"life_expect\": 78.269, \"pop\": 5305120, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.75, \"life_expect\": 80.745, \"pop\": 6276883, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.35, \"life_expect\": 67.81, \"pop\": 48633000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.498, \"life_expect\": 69.24, \"pop\": 50197600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.493, \"life_expect\": 71.06, \"pop\": 51987100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.325, \"life_expect\": 72.19, \"pop\": 53661100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.889, \"life_expect\": 73.48, \"pop\": 55571894, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.53, \"life_expect\": 74.98, \"pop\": 56451247, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.349, \"life_expect\": 76.42, \"pop\": 56731215, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.275, \"life_expect\": 77.44, \"pop\": 56742886, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.213, \"life_expect\": 78.82, \"pop\": 57274531, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.379, \"life_expect\": 80.546, \"pop\": 58103033, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.08, \"life_expect\": 62.61, \"pop\": 1488805, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.64, \"life_expect\": 65.61, \"pop\": 1631784, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.78, \"life_expect\": 67.51, \"pop\": 1777397, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.0, \"life_expect\": 69.0, \"pop\": 1943787, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 4.0, \"life_expect\": 70.11, \"pop\": 2104879, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.55, \"life_expect\": 71.21, \"pop\": 2228803, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.1, \"life_expect\": 71.77, \"pop\": 2318652, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.84, \"life_expect\": 71.766, \"pop\": 2347922, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.67, \"life_expect\": 72.262, \"pop\": 2469389, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.4289, \"life_expect\": 72.567, \"pop\": 2735520, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.08, \"life_expect\": 65.5, \"pop\": 89815060, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.02, \"life_expect\": 68.73, \"pop\": 94091638, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.0, \"life_expect\": 71.43, \"pop\": 98882534, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.07, \"life_expect\": 73.42, \"pop\": 104344973, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.81, \"life_expect\": 75.38, \"pop\": 111573116, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.76, \"life_expect\": 77.11, \"pop\": 116807309, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.6600000000000001, \"life_expect\": 78.67, \"pop\": 120754335, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.49, \"life_expect\": 79.36, \"pop\": 123537399, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.3900000000000001, \"life_expect\": 80.69, \"pop\": 125341354, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.27, \"life_expect\": 82.603, \"pop\": 127417244, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.816, \"life_expect\": 44.686, \"pop\": 7033999, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 47.949, \"pop\": 8156827, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 50.654, \"pop\": 9549179, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.0, \"life_expect\": 53.559, \"pop\": 11247182, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.6, \"life_expect\": 56.155, \"pop\": 13433414, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.2, \"life_expect\": 58.766, \"pop\": 16331401, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 6.5, \"life_expect\": 59.339, \"pop\": 19763285, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.4, \"life_expect\": 59.285, \"pop\": 23358413, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 54.407, \"pop\": 27060142, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 4.959, \"life_expect\": 54.11, \"pop\": 33829590, \"year\": 2005}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.8, \"life_expect\": 54.081, \"pop\": 8839427, \"year\": 1955}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.41, \"life_expect\": 56.656, \"pop\": 10391909, \"year\": 1960}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 4.09, \"life_expect\": 59.942, \"pop\": 11868751, \"year\": 1965}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.7199999999999998, \"life_expect\": 63.983, \"pop\": 13911902, \"year\": 1970}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.58, \"life_expect\": 67.159, \"pop\": 15801308, \"year\": 1975}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.93, \"life_expect\": 69.1, \"pop\": 17113626, \"year\": 1980}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.45, \"life_expect\": 70.647, \"pop\": 18481420, \"year\": 1985}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.35, \"life_expect\": 69.978, \"pop\": 20018546, \"year\": 1990}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.0938, \"life_expect\": 67.727, \"pop\": 21561856, \"year\": 1995}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.85, \"life_expect\": 67.297, \"pop\": 22912177, \"year\": 2005}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 6.332, \"life_expect\": 52.681, \"pop\": 21551834, \"year\": 1955}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 5.63, \"life_expect\": 55.292, \"pop\": 24784140, \"year\": 1960}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.708, \"life_expect\": 57.716, \"pop\": 28705000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.281, \"life_expect\": 62.612, \"pop\": 32241000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.919, \"life_expect\": 64.766, \"pop\": 35281000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.234, \"life_expect\": 67.123, \"pop\": 38124000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.601, \"life_expect\": 69.81, \"pop\": 40806000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.6960000000000002, \"life_expect\": 72.244, \"pop\": 42869000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.514, \"life_expect\": 74.647, \"pop\": 45264146, \"year\": 1995}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.21, \"life_expect\": 78.623, \"pop\": 48640671, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.72, \"life_expect\": 59.489, \"pop\": 1560985, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.689, \"life_expect\": 62.094, \"pop\": 1786235, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.336, \"life_expect\": 63.87, \"pop\": 2057945, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.78, \"life_expect\": 65.421, \"pop\": 2383029, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.311, \"life_expect\": 66.099, \"pop\": 3098159, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.895, \"life_expect\": 66.983, \"pop\": 3085876, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.313, \"life_expect\": 67.926, \"pop\": 3088235, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.0, \"life_expect\": 69.292, \"pop\": 3147267, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.6950000000000003, \"life_expect\": 70.265, \"pop\": 3334733, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.209, \"life_expect\": 71.993, \"pop\": 3826018, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.095, \"life_expect\": 72.99, \"pop\": 10750842, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.168, \"life_expect\": 73.23, \"pop\": 11486000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.797, \"life_expect\": 73.82, \"pop\": 12292000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.059, \"life_expect\": 73.75, \"pop\": 13032335, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.596, \"life_expect\": 75.24, \"pop\": 13653438, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5150000000000001, \"life_expect\": 76.05, \"pop\": 14143901, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5550000000000002, \"life_expect\": 76.83, \"pop\": 14491380, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.583, \"life_expect\": 77.42, \"pop\": 14951510, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.6, \"life_expect\": 78.03, \"pop\": 15459054, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.721, \"life_expect\": 79.762, \"pop\": 16407491, \"year\": 2005}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.07, \"life_expect\": 70.26, \"pop\": 2136168, \"year\": 1955}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.022, \"life_expect\": 71.24, \"pop\": 2371746, \"year\": 1960}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 3.348, \"life_expect\": 71.52, \"pop\": 2640400, \"year\": 1965}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.843, \"life_expect\": 71.89, \"pop\": 2828050, \"year\": 1970}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.178, \"life_expect\": 72.22, \"pop\": 3117800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.963, \"life_expect\": 73.84, \"pop\": 3170150, \"year\": 1980}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.053, \"life_expect\": 74.32, \"pop\": 3298050, \"year\": 1985}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.061, \"life_expect\": 76.33, \"pop\": 3359604, \"year\": 1990}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.952, \"life_expect\": 77.55, \"pop\": 3565990, \"year\": 1995}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.994, \"life_expect\": 80.204, \"pop\": 4035461, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 37.802, \"pop\": 35458978, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 39.36, \"pop\": 39914593, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 41.04, \"pop\": 45020052, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 42.821, \"pop\": 51027516, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 44.514, \"pop\": 58522112, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 45.826, \"pop\": 68550274, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.834, \"life_expect\": 46.886, \"pop\": 77573154, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.635, \"life_expect\": 47.472, \"pop\": 88510354, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.246, \"life_expect\": 47.464, \"pop\": 100960105, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.322, \"life_expect\": 46.859, \"pop\": 128765768, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.8369999999999997, \"life_expect\": 73.44, \"pop\": 3427409, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.898, \"life_expect\": 73.47, \"pop\": 3581239, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.719, \"life_expect\": 74.08, \"pop\": 3723153, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.248, \"life_expect\": 74.34, \"pop\": 3877386, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.81, \"life_expect\": 75.37, \"pop\": 4007313, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.687, \"life_expect\": 75.97, \"pop\": 4085620, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8, \"life_expect\": 75.89, \"pop\": 4152419, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8860000000000001, \"life_expect\": 77.32, \"pop\": 4242006, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.853, \"life_expect\": 78.32, \"pop\": 4359101, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8479999999999999, \"life_expect\": 80.196, \"pop\": 4593041, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 45.557, \"pop\": 44434445, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 47.67, \"pop\": 50386898, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 49.8, \"pop\": 57494940, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 51.929, \"pop\": 65705964, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 54.043, \"pop\": 74711541, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 56.158, \"pop\": 85219117, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.66, \"life_expect\": 58.245, \"pop\": 99060352, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 5.8, \"life_expect\": 60.838, \"pop\": 114578478, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 4.9596, \"life_expect\": 61.818, \"pop\": 128690285, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.5211, \"life_expect\": 65.483, \"pop\": 162419946, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 46.263, \"pop\": 8671500, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 49.096, \"pop\": 9931000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.5600000000000005, \"life_expect\": 51.445, \"pop\": 11467300, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.0, \"life_expect\": 55.448, \"pop\": 13192800, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 5.378, \"life_expect\": 58.447, \"pop\": 15161199, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.65, \"life_expect\": 61.406, \"pop\": 17295298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.1, \"life_expect\": 64.134, \"pop\": 19348926, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.7, \"life_expect\": 66.458, \"pop\": 21511443, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.0995, \"life_expect\": 68.386, \"pop\": 23846388, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.5065, \"life_expect\": 71.421, \"pop\": 27925628, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 7.13, \"life_expect\": 51.334, \"pop\": 24553055, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.85, \"life_expect\": 54.757, \"pop\": 28528939, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.5, \"life_expect\": 56.393, \"pop\": 33267569, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.0, \"life_expect\": 58.065, \"pop\": 38603696, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 5.5, \"life_expect\": 60.06, \"pop\": 44336842, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.95, \"life_expect\": 62.082, \"pop\": 50940182, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.55, \"life_expect\": 64.151, \"pop\": 57288037, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.143, \"life_expect\": 66.458, \"pop\": 64318120, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.7248, \"life_expect\": 68.564, \"pop\": 71717437, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.2327, \"life_expect\": 71.688, \"pop\": 87857473, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 3.29, \"life_expect\": 65.77, \"pop\": 27220668, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.65, \"life_expect\": 67.64, \"pop\": 29589842, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.27, \"life_expect\": 69.61, \"pop\": 31262358, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.25, \"life_expect\": 70.85, \"pop\": 32526000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.26, \"life_expect\": 70.67, \"pop\": 33969240, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.33, \"life_expect\": 71.32, \"pop\": 35578016, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.15, \"life_expect\": 70.98, \"pop\": 37225792, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.8900000000000001, \"life_expect\": 70.99, \"pop\": 38119408, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.478, \"life_expect\": 72.75, \"pop\": 38600642, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.227, \"life_expect\": 75.563, \"pop\": 38557984, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.03, \"life_expect\": 61.51, \"pop\": 8692600, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.074, \"life_expect\": 64.39, \"pop\": 9036700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.849, \"life_expect\": 66.6, \"pop\": 9128850, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.748, \"life_expect\": 69.26, \"pop\": 9044200, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.41, \"life_expect\": 70.41, \"pop\": 9411090, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.982, \"life_expect\": 72.77, \"pop\": 9777800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.5939999999999999, \"life_expect\": 74.06, \"pop\": 9897192, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.516, \"life_expect\": 74.86, \"pop\": 9922689, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.475, \"life_expect\": 75.97, \"pop\": 10065543, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.455, \"life_expect\": 78.098, \"pop\": 10566212, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.0, \"life_expect\": 41.5, \"pop\": 2698272, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.1, \"life_expect\": 43.0, \"pop\": 3031804, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.2, \"life_expect\": 44.1, \"pop\": 3264640, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.29, \"life_expect\": 44.6, \"pop\": 3769171, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.492, \"life_expect\": 45.0, \"pop\": 4356863, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.5, \"life_expect\": 46.218, \"pop\": 5138689, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.25, \"life_expect\": 44.02, \"pop\": 6009833, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.9, \"life_expect\": 23.599, \"pop\": 6923738, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.0993, \"life_expect\": 36.087, \"pop\": 5706501, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 5.9169, \"life_expect\": 46.242, \"pop\": 8440820, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.175, \"life_expect\": 42.868, \"pop\": 4243218, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 45.914, \"pop\": 4718301, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 49.901, \"pop\": 5327432, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.298, \"life_expect\": 53.886, \"pop\": 6109051, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.2780000000000005, \"life_expect\": 58.69, \"pop\": 7204820, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.015, \"life_expect\": 63.012, \"pop\": 9999161, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 6.217, \"life_expect\": 66.295, \"pop\": 13330067, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 5.446, \"life_expect\": 68.768, \"pop\": 16060761, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 4.621, \"life_expect\": 70.533, \"pop\": 19966998, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.352, \"life_expect\": 72.777, \"pop\": 26417599, \"year\": 2005}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.5, \"life_expect\": 47.985, \"pop\": 15368551, \"year\": 1955}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.3, \"life_expect\": 49.951, \"pop\": 17416653, \"year\": 1960}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.7, \"life_expect\": 51.927, \"pop\": 19898242, \"year\": 1965}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.47, \"life_expect\": 53.696, \"pop\": 22739921, \"year\": 1970}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.0, \"life_expect\": 55.527, \"pop\": 25815144, \"year\": 1975}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 4.556, \"life_expect\": 58.161, \"pop\": 29251588, \"year\": 1980}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.85, \"life_expect\": 60.834, \"pop\": 34254092, \"year\": 1985}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.343, \"life_expect\": 61.888, \"pop\": 38391094, \"year\": 1990}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.954, \"life_expect\": 60.236, \"pop\": 41779149, \"year\": 1995}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.637, \"life_expect\": 49.339, \"pop\": 44344136, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.75, \"life_expect\": 66.66, \"pop\": 29318745, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.89, \"life_expect\": 69.69, \"pop\": 30641187, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.92, \"life_expect\": 71.44, \"pop\": 32084511, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.86, \"life_expect\": 73.06, \"pop\": 33876479, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.5700000000000003, \"life_expect\": 74.39, \"pop\": 35563535, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.8900000000000001, \"life_expect\": 76.3, \"pop\": 37488360, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.48, \"life_expect\": 76.9, \"pop\": 38534853, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.27, \"life_expect\": 77.57, \"pop\": 39350769, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.182, \"life_expect\": 78.77, \"pop\": 39749715, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.409, \"life_expect\": 80.941, \"pop\": 40341462, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.34, \"life_expect\": 70.56, \"pop\": 4980000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.51, \"life_expect\": 71.32, \"pop\": 5362000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.27, \"life_expect\": 72.77, \"pop\": 5943000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.82, \"life_expect\": 73.78, \"pop\": 6267000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 75.39, \"pop\": 6403500, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 76.21, \"pop\": 6385229, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 77.41, \"pop\": 6563770, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.54, \"life_expect\": 78.03, \"pop\": 6836626, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.47, \"life_expect\": 79.37, \"pop\": 7157106, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.42, \"life_expect\": 81.701, \"pop\": 7489370, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.6, \"life_expect\": 48.079, \"pop\": 24144571, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.19, \"life_expect\": 52.098, \"pop\": 28217122, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.7, \"life_expect\": 54.336, \"pop\": 31950718, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.3, \"life_expect\": 57.005, \"pop\": 35758382, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.715, \"life_expect\": 59.507, \"pop\": 40529798, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.15, \"life_expect\": 61.036, \"pop\": 45120802, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 3.276, \"life_expect\": 63.108, \"pop\": 50669003, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.904, \"life_expect\": 66.146, \"pop\": 56084632, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.574, \"life_expect\": 68.835, \"pop\": 61188984, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.143, \"life_expect\": 71.777, \"pop\": 69660559, \"year\": 2005}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.49, \"life_expect\": 70.42, \"pop\": 50946000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.81, \"life_expect\": 70.76, \"pop\": 52372000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.52, \"life_expect\": 71.36, \"pop\": 54350000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.04, \"life_expect\": 72.01, \"pop\": 55632000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.72, \"life_expect\": 72.76, \"pop\": 56215000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.8, \"life_expect\": 74.04, \"pop\": 56314000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.81, \"life_expect\": 75.007, \"pop\": 56620240, \"year\": 1985}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.78, \"life_expect\": 76.42, \"pop\": 57493307, \"year\": 1990}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.7000000000000002, \"life_expect\": 77.218, \"pop\": 58426014, \"year\": 1995}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.815, \"life_expect\": 79.425, \"pop\": 60441457, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.4585, \"life_expect\": 57.907, \"pop\": 6170497, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.657, \"life_expect\": 60.77, \"pop\": 7556483, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 5.9045000000000005, \"life_expect\": 63.479, \"pop\": 9067735, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.941, \"life_expect\": 65.712, \"pop\": 10758017, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.4685, \"life_expect\": 67.456, \"pop\": 12674987, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.957, \"life_expect\": 68.557, \"pop\": 14767890, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.6485000000000003, \"life_expect\": 70.19, \"pop\": 16997509, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.25, \"life_expect\": 71.15, \"pop\": 19325222, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.9415, \"life_expect\": 72.146, \"pop\": 21555902, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.547, \"life_expect\": 73.747, \"pop\": 25375281, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "select_year = alt.selection_single(\n",
    "    name='select', fields=['year'], init={'year': 1955},\n",
    "    bind=alt.binding_range(min=1955, max=2005, step=5)\n",
    ")\n",
    "\n",
    "alt.Chart(data).mark_point(filled=True).encode(\n",
    "    alt.X('fertility:Q', scale=alt.Scale(domain=[0,9])),\n",
    "    alt.Y('life_expect:Q', scale=alt.Scale(domain=[0,90])),\n",
    "    alt.Size('pop:Q', scale=alt.Scale(domain=[0, 1200000000], range=[0,1000])),\n",
    "    alt.Color('cluster:N', legend=None),\n",
    "    alt.OpacityValue(0.5),\n",
    "    alt.Tooltip('country:N'),\n",
    "    alt.Order('pop:Q', sort='descending')\n",
    ").add_selection(select_year).transform_filter(select_year)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "UPdDrmm9YK5E"
   },
   "source": [
    "## Graphical Marks\n",
    "\n",
    "Our exploration of encoding channels above exclusively uses `point` marks to visualize the data. However, the `point` mark type is only one of the many geometric shapes that can be used to visually represent data. Altair includes a number of built-in mark types, including:\n",
    "\n",
    "- `mark_area()` - Filled areas defined by a top-line and a baseline.\n",
    "- `mark_bar()` -\tRectangular bars.\n",
    "- `mark_circle()`\t- Scatter plot points as filled circles.\n",
    "- `mark_line()` - Connected line segments.\n",
    "- `mark_point()` - Scatter plot points with configurable shapes.\n",
    "- `mark_rect()` - Filled rectangles, useful for heatmaps.\n",
    "- `mark_rule()` - Vertical or horizontal lines spanning the axis.\n",
    "- `mark_square()` - Scatter plot points as filled squares.\n",
    "- `mark_text()` - Scatter plot points represented by text.\n",
    "- `mark_tick()` - Vertical or horizontal tick marks.\t\n",
    "\n",
    "For a complete list, and links to examples, see the [Altair marks documentation](https://altair-viz.github.io/user_guide/marks.html). Next, we will step through a number of the most commonly used mark types for statistical graphics."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "jVp7cC-BbYF5"
   },
   "source": [
    "### Point Marks\n",
    "\n",
    "The `point` mark type conveys specific points, as in *scatter plots* and *dot plots*. In addition to `x` and `y` encoding channels (to specify 2D point positions), point marks can use `color`, `size`, and `shape` encodings to convey additional data fields.\n",
    "\n",
    "Below is a dot plot of `fertility`, with the `cluster` field redundantly encoded using both the `y` and `shape` channels. \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "3jrFfaKCtbyL",
    "outputId": "6332a348-f8f0-4dd8-9c4a-63687e286d4a"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-8d64a89d3db14fcbbbf283b7be1791f0\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-8d64a89d3db14fcbbbf283b7be1791f0\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"point\", \"encoding\": {\"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:N'),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "bONM4Ccrt4Sw"
   },
   "source": [
    "In addition to encoding channels, marks can be stylized by providing values to the `mark_*()` methods.\n",
    "\n",
    "For example: point marks are drawn with stroked outlines by default, but can be specified to use `filled` shapes instead. Similarly, you can set a default `size` to set the total pixel area of the point mark.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "3-HgJ1PjvKdH",
    "outputId": "dcf26fa9-281b-4297-da50-84c7f5ccd318"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-d4be5b11e57e44b1aad3de613b97b3f3\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-d4be5b11e57e44b1aad3de613b97b3f3\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"point\", \"filled\": true, \"size\": 100}, \"encoding\": {\"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_point(filled=True, size=100).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:N'),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "CGMm4gyNcLzB"
   },
   "source": [
    "### Circle Marks\n",
    "\n",
    "The `circle` mark type is a convenient shorthand for `point` marks drawn as filled circles."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "R7JgFhB-vn5X",
    "outputId": "80cd9d0f-c126-4673-bfcf-eaf5b34e0058"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-0ca26cf095734d2aa4605e3170946e44\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-0ca26cf095734d2aa4605e3170946e44\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"circle\", \"size\": 100}, \"encoding\": {\"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_circle(size=100).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:N'),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "IAZSJlWhcOr_"
   },
   "source": [
    "### Square Marks\n",
    "\n",
    "The `square` mark type is a convenient shorthand for `point` marks drawn as filled squares."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "rfby5R-Mvuwx",
    "outputId": "8ff4b0d4-f3ce-45e5-f597-1a6fd296ba47"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-df19ae0553a94502849703a9114dc0fc\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-df19ae0553a94502849703a9114dc0fc\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": {\"type\": \"square\", \"size\": 100}, \"encoding\": {\"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_square(size=100).encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:N'),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "SJF0vNqGcRdv"
   },
   "source": [
    "### Tick Marks\n",
    "\n",
    "The `tick` mark type conveys a data point using a short line segment or \"tick\". These are particularly useful for comparing values along a single dimension with minimal overlap. A *dot plot* drawn with tick marks is sometimes referred to as a *strip plot*."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "Thvp_VJ2v-xd",
    "outputId": "c6133250-333f-4c29-e217-221634dd8337"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-d4a3776ab77d4000a0c13949e8d5c369\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-d4a3776ab77d4000a0c13949e8d5c369\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"tick\", \"encoding\": {\"shape\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"fertility\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_tick().encode(\n",
    "    alt.X('fertility:Q'),\n",
    "    alt.Y('cluster:N'),\n",
    "    alt.Shape('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "x8j5XVZJcB7l"
   },
   "source": [
    "### Bar Marks\n",
    "\n",
    "The \\`bar\\` mark type draws a rectangle with a position, width, and height.\n",
    "\n",
    "The plot below is a simple bar chart of the population (\\`pop\\`) of each country."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 445
    },
    "colab_type": "code",
    "id": "eFN9Kw85xFQK",
    "outputId": "8da431d3-9ba7-4ecf-de55-e478c4527a39"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-3e9b6fd6cbb14871b1da0bc4feb52bed\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-3e9b6fd6cbb14871b1da0bc4feb52bed\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"bar\", \"encoding\": {\"x\": {\"type\": \"nominal\", \"field\": \"country\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_bar().encode(\n",
    "    alt.X('country:N'),\n",
    "    alt.Y('pop:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "rHX8bKgbzW3I"
   },
   "source": [
    "The bar width is set to a default size. We will discuss how to adjust the bar width later in this notebook. (A subsequent notebook will take a closer look at configuring axes, scales, and legends.)\n",
    "\n",
    "Bars can also be stacked. Let's change the `x` encoding to use the `cluster` field, and encode `country` using the `color` channel. We'll also disable the legend (which would be very long with colors for all countries!) and use tooltips for the country name."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 368
    },
    "colab_type": "code",
    "id": "x9maAWhOxsrq",
    "outputId": "7960be03-eefd-4c3f-a114-8405395c772c"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-28253736cd0747bea688757d2ecc8abc\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-28253736cd0747bea688757d2ecc8abc\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\", \"legend\": null}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"nominal\", \"field\": \"cluster\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_bar().encode(\n",
    "    alt.X('cluster:N'),\n",
    "    alt.Y('pop:Q'),\n",
    "    alt.Color('country:N', legend=None),\n",
    "    alt.Tooltip('country:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "de4181jhzgUx"
   },
   "source": [
    "In the chart above, the use of the `color` encoding channel causes Altair / Vega-Lite to automatically stack the bar marks. Otherwise, bars would be drawn on top of each other! Try adding the parameter `stack=None` to the `y` encoding channel to see what happens if we don't apply stacking..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "mLSz2vHb2qiV"
   },
   "source": [
    "The examples above create bar charts from a zero-baseline, and the `y` channel only encodes the non-zero value (or height) of the bar. However, the bar mark also allows you to specify starting and ending points to convey ranges.\n",
    "\n",
    "The chart below uses the `x` (starting point) and `x2` (ending point) channels to show the range of life expectancies within each regional cluster. Below we use the `min` and `max` aggregation functions to determine the end points of the range; we will discuss aggregation in greater detail in the next notebook!\n",
    "\n",
    "Alternatively, you can use `x` and `width` to provide a starting point plus offset, such that `x2 = x + width`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 192
    },
    "colab_type": "code",
    "id": "NxEVEQLj0l9t",
    "outputId": "2fa67514-b66c-4449-a1e3-c0b1b377ed3a"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-6db0eca949c04115898beb765cb6d832\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-6db0eca949c04115898beb765cb6d832\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-fdeb0b749a6385830bd1445d39ad6ea0\"}, \"mark\": \"bar\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"aggregate\": \"min\", \"field\": \"life_expect\"}, \"x2\": {\"aggregate\": \"max\", \"field\": \"life_expect\"}, \"y\": {\"type\": \"nominal\", \"field\": \"cluster\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fdeb0b749a6385830bd1445d39ad6ea0\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data2000).mark_bar().encode(\n",
    "    alt.X('min(life_expect):Q'),\n",
    "    alt.X2('max(life_expect):Q'),\n",
    "    alt.Y('cluster:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "bTnEQk1NcD7y"
   },
   "source": [
    "### Line Marks\n",
    "\n",
    "The `line` mark type connects plotted points with line segments, for example so that a line's slope conveys information about the rate of change.\n",
    "\n",
    "Let's plot a line chart of fertility per country over the years, using the full, unfiltered global development data frame. We'll again hide the legend and use tooltips instead.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "lTWmDwv1Jhzt",
    "outputId": "7bbd15a9-4b8f-4f66-fe7e-6a55f2c38449"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-570313bee630423882c03825a5cdae14\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-570313bee630423882c03825a5cdae14\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-89be1acdd14c7effd56f4dd0fabf92c3\"}, \"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\", \"legend\": null}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"fertility\"}}, \"width\": 400, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-89be1acdd14c7effd56f4dd0fabf92c3\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 30.332, \"pop\": 8891209, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 31.997, \"pop\": 9829450, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 34.02, \"pop\": 10997885, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 36.088, \"pop\": 12430623, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 38.438, \"pop\": 14132019, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.8, \"life_expect\": 39.854, \"pop\": 15112149, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.9, \"life_expect\": 40.822, \"pop\": 13796928, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.674, \"pop\": 14669339, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.763, \"pop\": 20881480, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.0685, \"life_expect\": 43.828, \"pop\": 29928987, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1265, \"life_expect\": 64.399, \"pop\": 18927821, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.0895, \"life_expect\": 65.142, \"pop\": 20616009, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.049, \"life_expect\": 65.634, \"pop\": 22283100, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1455, \"life_expect\": 67.065, \"pop\": 23962313, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.44, \"life_expect\": 68.481, \"pop\": 26081880, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.15, \"life_expect\": 69.942, \"pop\": 28369799, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.053, \"life_expect\": 70.774, \"pop\": 30675059, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.9, \"life_expect\": 71.868, \"pop\": 33022202, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.63, \"life_expect\": 73.275, \"pop\": 35311049, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.254, \"life_expect\": 75.32, \"pop\": 39537943, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 5.15, \"life_expect\": 64.381, \"pop\": 53865, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 4.399, \"life_expect\": 66.606, \"pop\": 57203, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 3.301, \"life_expect\": 68.336, \"pop\": 59020, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.651, \"life_expect\": 70.941, \"pop\": 59039, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.45, \"life_expect\": 71.83, \"pop\": 59390, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.358, \"life_expect\": 74.116, \"pop\": 60266, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.3, \"life_expect\": 74.494, \"pop\": 64129, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.2800000000000002, \"life_expect\": 74.108, \"pop\": 66653, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.208, \"life_expect\": 73.011, \"pop\": 67836, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.04, \"life_expect\": 74.239, \"pop\": 71566, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.406, \"life_expect\": 70.33, \"pop\": 9277087, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.274, \"life_expect\": 70.93, \"pop\": 10361273, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.871, \"life_expect\": 71.1, \"pop\": 11439384, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.535, \"life_expect\": 71.93, \"pop\": 12660160, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.9889999999999999, \"life_expect\": 73.49, \"pop\": 13771400, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.907, \"life_expect\": 74.74, \"pop\": 14615900, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.859, \"life_expect\": 76.32, \"pop\": 15788300, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.8599999999999999, \"life_expect\": 77.56, \"pop\": 17022133, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.776, \"life_expect\": 78.83, \"pop\": 18116171, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.788, \"life_expect\": 81.235, \"pop\": 20090437, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.52, \"life_expect\": 67.48, \"pop\": 6946885, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.7800000000000002, \"life_expect\": 69.54, \"pop\": 7047437, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.5300000000000002, \"life_expect\": 70.14, \"pop\": 7270889, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.02, \"life_expect\": 70.63, \"pop\": 7467086, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.6400000000000001, \"life_expect\": 72.17, \"pop\": 7578903, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.62, \"life_expect\": 73.18, \"pop\": 7549433, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.45, \"life_expect\": 74.94, \"pop\": 7559776, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.47, \"life_expect\": 76.04, \"pop\": 7722953, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.388, \"life_expect\": 77.51, \"pop\": 8047433, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.42, \"life_expect\": 79.829, \"pop\": 8184691, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.305, \"life_expect\": 62.405, \"pop\": 87138, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.503, \"life_expect\": 64.209, \"pop\": 112234, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.794, \"life_expect\": 65.795, \"pop\": 139205, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.444, \"life_expect\": 66.515, \"pop\": 170323, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.221, \"life_expect\": 67.199, \"pop\": 189139, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.16, \"life_expect\": 67.874, \"pop\": 209944, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.62, \"life_expect\": 69.524, \"pop\": 234988, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.6, \"life_expect\": 69.171, \"pop\": 257253, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.4, \"life_expect\": 68.472, \"pop\": 275303, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.0221, \"life_expect\": 73.495, \"pop\": 301790, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.76, \"life_expect\": 39.348, \"pop\": 49601520, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.85, \"life_expect\": 41.216, \"pop\": 54621538, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.6, \"life_expect\": 43.453, \"pop\": 60332117, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.15, \"life_expect\": 45.252, \"pop\": 67402621, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.6, \"life_expect\": 46.923, \"pop\": 76253310, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.25, \"life_expect\": 50.009, \"pop\": 88076996, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.629, \"life_expect\": 52.819, \"pop\": 99752733, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.117, \"life_expect\": 56.018, \"pop\": 109896945, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.5042999999999997, \"life_expect\": 59.412, \"pop\": 119186448, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 2.826, \"life_expect\": 64.062, \"pop\": 144319628, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.67, \"life_expect\": 62.57, \"pop\": 227255, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.26, \"life_expect\": 65.87, \"pop\": 232339, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 3.45, \"life_expect\": 67.62, \"pop\": 234980, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.74, \"life_expect\": 69.42, \"pop\": 238756, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.19, \"life_expect\": 71.27, \"pop\": 247147, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.92, \"life_expect\": 72.695, \"pop\": 251966, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.75, \"life_expect\": 74.027, \"pop\": 257446, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.6, \"life_expect\": 74.894, \"pop\": 262624, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 74.912, \"pop\": 267907, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 77.296, \"pop\": 278870, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.496, \"life_expect\": 69.24, \"pop\": 8868475, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.644, \"life_expect\": 70.25, \"pop\": 9118700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.392, \"life_expect\": 70.94, \"pop\": 9448100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.015, \"life_expect\": 71.44, \"pop\": 9637800, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.705, \"life_expect\": 72.8, \"pop\": 9794800, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.595, \"life_expect\": 73.93, \"pop\": 9846800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.5590000000000002, \"life_expect\": 75.35, \"pop\": 9858200, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.613, \"life_expect\": 76.46, \"pop\": 9969310, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.604, \"life_expect\": 77.53, \"pop\": 10155459, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.646, \"life_expect\": 79.441, \"pop\": 10364388, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.75, \"life_expect\": 41.89, \"pop\": 3074311, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.63, \"life_expect\": 43.428, \"pop\": 3434073, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5600000000000005, \"life_expect\": 45.032, \"pop\": 3853315, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5, \"life_expect\": 46.714, \"pop\": 4346218, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.8, \"life_expect\": 50.023, \"pop\": 4914316, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.2995, \"life_expect\": 53.859, \"pop\": 5441298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.0, \"life_expect\": 57.251, \"pop\": 5934935, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.8, \"life_expect\": 59.957, \"pop\": 6573900, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.324, \"life_expect\": 62.05, \"pop\": 7376582, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.5, \"life_expect\": 65.554, \"pop\": 8857870, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 53.285, \"pop\": 61773546, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 55.665, \"pop\": 71694810, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 5.38, \"life_expect\": 57.632, \"pop\": 83092908, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.7175, \"life_expect\": 59.504, \"pop\": 95684297, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.305, \"life_expect\": 61.489, \"pop\": 108823732, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.8, \"life_expect\": 63.336, \"pop\": 122958132, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.1, \"life_expect\": 65.205, \"pop\": 137302933, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.6, \"life_expect\": 67.057, \"pop\": 151083809, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.45, \"life_expect\": 69.388, \"pop\": 163542501, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.245, \"life_expect\": 72.39, \"pop\": 186112794, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.486, \"life_expect\": 56.074, \"pop\": 6743269, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.4385, \"life_expect\": 57.924, \"pop\": 7585349, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 4.4405, \"life_expect\": 60.523, \"pop\": 8509950, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 3.63, \"life_expect\": 63.441, \"pop\": 9368558, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.803, \"life_expect\": 67.052, \"pop\": 10251542, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.6710000000000003, \"life_expect\": 70.565, \"pop\": 11093718, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.65, \"life_expect\": 72.492, \"pop\": 12066701, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.55, \"life_expect\": 74.126, \"pop\": 13127760, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.21, \"life_expect\": 75.816, \"pop\": 14205449, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 1.944, \"life_expect\": 78.553, \"pop\": 15980912, \"year\": 2005}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.59, \"life_expect\": 50.54896, \"pop\": 608655000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.72, \"life_expect\": 44.50136, \"pop\": 667070000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 6.06, \"life_expect\": 58.38112, \"pop\": 715185000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 4.86, \"life_expect\": 63.11888, \"pop\": 818315000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 3.32, \"life_expect\": 63.96736, \"pop\": 916395000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.55, \"life_expect\": 65.525, \"pop\": 981235000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.46, \"life_expect\": 67.274, \"pop\": 1051040000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.92, \"life_expect\": 68.69, \"pop\": 1135185000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7810000000000001, \"life_expect\": 70.426, \"pop\": 1204855000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.725, \"life_expect\": 72.961, \"pop\": 1303182268, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 55.118, \"pop\": 13588405, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 57.863, \"pop\": 15952727, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.18, \"life_expect\": 59.963, \"pop\": 18646175, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 5.0005, \"life_expect\": 61.623, \"pop\": 21429658, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 4.3385, \"life_expect\": 63.837, \"pop\": 24114177, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.685, \"life_expect\": 66.653, \"pop\": 26582811, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.172, \"life_expect\": 67.768, \"pop\": 29678395, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.93005, \"life_expect\": 68.421, \"pop\": 32858579, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.7, \"life_expect\": 70.313, \"pop\": 36280883, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.2205, \"life_expect\": 72.889, \"pop\": 42954279, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.1135, \"life_expect\": 60.026, \"pop\": 1031782, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.2245, \"life_expect\": 62.842, \"pop\": 1248022, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 5.801, \"life_expect\": 65.424, \"pop\": 1487605, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 4.346, \"life_expect\": 67.849, \"pop\": 1735523, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.7755, \"life_expect\": 70.75, \"pop\": 1991580, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.527, \"life_expect\": 73.45, \"pop\": 2299124, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.374, \"life_expect\": 74.752, \"pop\": 2643808, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.9450000000000003, \"life_expect\": 75.713, \"pop\": 3027175, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.5835, \"life_expect\": 77.26, \"pop\": 3383786, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.0985, \"life_expect\": 78.782, \"pop\": 4016173, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.42, \"life_expect\": 64.77, \"pop\": 3955526, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.27, \"life_expect\": 67.13, \"pop\": 4036145, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.09, \"life_expect\": 68.5, \"pop\": 4133313, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 69.61, \"pop\": 4205389, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.02, \"life_expect\": 70.64, \"pop\": 4255000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 70.46, \"pop\": 4383000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.8399999999999999, \"life_expect\": 71.52, \"pop\": 4457874, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.52, \"life_expect\": 72.527, \"pop\": 4508347, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.537, \"life_expect\": 73.68, \"pop\": 4496683, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.346, \"life_expect\": 75.748, \"pop\": 4495904, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6995, \"life_expect\": 62.325, \"pop\": 6381106, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.6805, \"life_expect\": 65.246, \"pop\": 7027210, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.3, \"life_expect\": 68.29, \"pop\": 7809916, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6, \"life_expect\": 70.723, \"pop\": 8542746, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 2.15, \"life_expect\": 72.649, \"pop\": 9290074, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 73.717, \"pop\": 9652975, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 74.174, \"pop\": 10078658, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6505, \"life_expect\": 74.414, \"pop\": 10544793, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6095000000000002, \"life_expect\": 76.151, \"pop\": 10896802, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.49, \"life_expect\": 78.273, \"pop\": 11346670, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.6405, \"life_expect\": 49.828, \"pop\": 2737257, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.3505, \"life_expect\": 53.459, \"pop\": 3231488, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 6.6495, \"life_expect\": 56.751, \"pop\": 3805881, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 5.71, \"life_expect\": 59.631, \"pop\": 4422755, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.76, \"life_expect\": 61.788, \"pop\": 5048499, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.0, \"life_expect\": 63.727, \"pop\": 5696855, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.47, \"life_expect\": 66.046, \"pop\": 6377765, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.1995, \"life_expect\": 68.457, \"pop\": 7077651, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.05, \"life_expect\": 69.957, \"pop\": 7730224, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.81, \"life_expect\": 72.235, \"pop\": 9049595, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 51.356, \"pop\": 3842399, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 54.64, \"pop\": 4415956, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.5, \"life_expect\": 56.678, \"pop\": 5117779, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.0005, \"life_expect\": 58.796, \"pop\": 5939246, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 5.4005, \"life_expect\": 61.31, \"pop\": 6871698, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.7005, \"life_expect\": 64.342, \"pop\": 7920499, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.0, \"life_expect\": 67.231, \"pop\": 9061664, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.4005, \"life_expect\": 69.613, \"pop\": 10318036, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.1, \"life_expect\": 72.312, \"pop\": 11438004, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.578, \"life_expect\": 74.994, \"pop\": 13363593, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.97, \"life_expect\": 44.444, \"pop\": 23855527, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 7.073, \"life_expect\": 46.992, \"pop\": 26846610, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.5600000000000005, \"life_expect\": 49.293, \"pop\": 30265148, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.855, \"life_expect\": 51.137, \"pop\": 33574026, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.609, \"life_expect\": 53.319, \"pop\": 36952499, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.332, \"life_expect\": 56.006, \"pop\": 42634215, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 4.833, \"life_expect\": 59.797, \"pop\": 50052381, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.908, \"life_expect\": 63.674, \"pop\": 56694413, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.5, \"life_expect\": 67.217, \"pop\": 63321615, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 2.891, \"life_expect\": 71.338, \"pop\": 77505756, \"year\": 2005}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8065, \"life_expect\": 48.57, \"pop\": 2221139, \"year\": 1955}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8469999999999995, \"life_expect\": 52.307, \"pop\": 2581583, \"year\": 1960}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.621, \"life_expect\": 55.855, \"pop\": 3017852, \"year\": 1965}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.0995, \"life_expect\": 58.207, \"pop\": 3603907, \"year\": 1970}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 5.5996, \"life_expect\": 56.696, \"pop\": 4071179, \"year\": 1975}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 4.5, \"life_expect\": 56.604, \"pop\": 4566199, \"year\": 1980}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.901, \"life_expect\": 63.154, \"pop\": 4664361, \"year\": 1985}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.52, \"life_expect\": 66.798, \"pop\": 5099884, \"year\": 1990}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.17, \"life_expect\": 69.535, \"pop\": 5568437, \"year\": 1995}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.6825, \"life_expect\": 71.878, \"pop\": 6704932, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.769, \"life_expect\": 67.49, \"pop\": 4234900, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.66, \"life_expect\": 68.75, \"pop\": 4429600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.191, \"life_expect\": 69.83, \"pop\": 4563732, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.623, \"life_expect\": 70.87, \"pop\": 4606307, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.663, \"life_expect\": 72.52, \"pop\": 4711439, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.685, \"life_expect\": 74.55, \"pop\": 4779535, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.6600000000000001, \"life_expect\": 74.83, \"pop\": 4901783, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.819, \"life_expect\": 75.7, \"pop\": 4986431, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.7429999999999999, \"life_expect\": 77.13, \"pop\": 5104654, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.8250000000000002, \"life_expect\": 79.313, \"pop\": 5223442, \"year\": 2005}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.7119999999999997, \"life_expect\": 68.93, \"pop\": 43427669, \"year\": 1955}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.85, \"life_expect\": 70.51, \"pop\": 45670000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.607, \"life_expect\": 71.55, \"pop\": 48763000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.31, \"life_expect\": 72.38, \"pop\": 50787000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.862, \"life_expect\": 73.83, \"pop\": 52758427, \"year\": 1975}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.866, \"life_expect\": 74.89, \"pop\": 53869743, \"year\": 1980}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8050000000000002, \"life_expect\": 76.34, \"pop\": 55171224, \"year\": 1985}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.713, \"life_expect\": 77.46, \"pop\": 56735161, \"year\": 1990}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.7624, \"life_expect\": 78.64, \"pop\": 58149727, \"year\": 1995}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8916, \"life_expect\": 80.657, \"pop\": 60656178, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.909, \"life_expect\": 62.625, \"pop\": 3827154, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.979, \"life_expect\": 64.644, \"pop\": 4146570, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.6109999999999998, \"life_expect\": 66.654, \"pop\": 4464959, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.601, \"life_expect\": 68.158, \"pop\": 4694491, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.39, \"life_expect\": 69.634, \"pop\": 4897656, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.269, \"life_expect\": 69.638, \"pop\": 5045697, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.263, \"life_expect\": 70.45, \"pop\": 5192957, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.9500000000000002, \"life_expect\": 70.465, \"pop\": 5426207, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.58, \"life_expect\": 70.49, \"pop\": 5012952, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.407, \"life_expect\": 70.987, \"pop\": 4677401, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.3, \"life_expect\": 69.1, \"pop\": 70195612, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.49, \"life_expect\": 70.3, \"pop\": 72480869, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.32, \"life_expect\": 70.8, \"pop\": 75638851, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.6400000000000001, \"life_expect\": 71.0, \"pop\": 77783164, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.52, \"life_expect\": 72.5, \"pop\": 78682325, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.46, \"life_expect\": 73.8, \"pop\": 78297904, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.43, \"life_expect\": 74.847, \"pop\": 77684907, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.31, \"life_expect\": 76.07, \"pop\": 79380394, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.34, \"life_expect\": 77.34, \"pop\": 81653702, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.3599999999999999, \"life_expect\": 79.406, \"pop\": 82431390, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.27, \"life_expect\": 67.86, \"pop\": 7965538, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.2, \"life_expect\": 69.51, \"pop\": 8327405, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.38, \"life_expect\": 71.0, \"pop\": 8550333, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 72.34, \"pop\": 8792806, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 73.68, \"pop\": 9046542, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.96, \"life_expect\": 75.24, \"pop\": 9642505, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.53, \"life_expect\": 76.67, \"pop\": 9923253, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.37, \"life_expect\": 77.03, \"pop\": 10129603, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.296, \"life_expect\": 77.869, \"pop\": 10457554, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.325, \"life_expect\": 79.483, \"pop\": 10668354, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.7, \"life_expect\": 63.114, \"pop\": 84621, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.4, \"life_expect\": 63.608, \"pop\": 90148, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.8, \"life_expect\": 64.091, \"pop\": 93290, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.6, \"life_expect\": 64.577, \"pop\": 95410, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.3, \"life_expect\": 65.035, \"pop\": 95819, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.23, \"life_expect\": 65.503, \"pop\": 90164, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.14, \"life_expect\": 66.002, \"pop\": 92203, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 3.26, \"life_expect\": 66.469, \"pop\": 92360, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.814, \"life_expect\": 66.986, \"pop\": 90603, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.302, \"life_expect\": 68.724, \"pop\": 89502, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 40.696, \"pop\": 3376419, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 43.59, \"pop\": 3722743, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.0, \"life_expect\": 46.243, \"pop\": 4137405, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.6005, \"life_expect\": 48.042, \"pop\": 4604915, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.8, \"life_expect\": 49.923, \"pop\": 4828338, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.2099, \"life_expect\": 51.461, \"pop\": 5029725, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.69985, \"life_expect\": 53.636, \"pop\": 5517977, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.14985, \"life_expect\": 55.089, \"pop\": 6126101, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.61995, \"life_expect\": 56.671, \"pop\": 6675578, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 3.5445, \"life_expect\": 60.916, \"pop\": 8121622, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.72, \"life_expect\": 64.75, \"pop\": 2490400, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 5.31, \"life_expect\": 67.65, \"pop\": 3075300, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.02, \"life_expect\": 70.0, \"pop\": 3597900, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.89, \"life_expect\": 72.0, \"pop\": 3959000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.32, \"life_expect\": 73.6, \"pop\": 4395800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.8, \"life_expect\": 75.45, \"pop\": 5063100, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.31, \"life_expect\": 76.2, \"pop\": 5456200, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.288, \"life_expect\": 77.601, \"pop\": 5687959, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.08, \"life_expect\": 80.0, \"pop\": 6225347, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.966, \"life_expect\": 82.208, \"pop\": 6898686, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 4.023, \"life_expect\": 73.47, \"pop\": 158044, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.943, \"life_expect\": 73.68, \"pop\": 175860, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.154, \"life_expect\": 73.73, \"pop\": 192288, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.843, \"life_expect\": 74.46, \"pop\": 204104, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.287, \"life_expect\": 76.11, \"pop\": 218031, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.248, \"life_expect\": 76.99, \"pop\": 228161, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.116, \"life_expect\": 77.23, \"pop\": 241403, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.194, \"life_expect\": 78.77, \"pop\": 254719, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.056, \"life_expect\": 78.95, \"pop\": 267527, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.052, \"life_expect\": 81.757, \"pop\": 296737, \"year\": 2005}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8961, \"life_expect\": 40.249, \"pop\": 393000000, \"year\": 1955}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8216, \"life_expect\": 43.605, \"pop\": 434000000, \"year\": 1960}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.6058, \"life_expect\": 47.193, \"pop\": 485000000, \"year\": 1965}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.264, \"life_expect\": 50.651, \"pop\": 541000000, \"year\": 1970}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.8888, \"life_expect\": 54.208, \"pop\": 607000000, \"year\": 1975}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.4975, \"life_expect\": 56.596, \"pop\": 679000000, \"year\": 1980}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.15, \"life_expect\": 58.553, \"pop\": 755000000, \"year\": 1985}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.8648, \"life_expect\": 60.223, \"pop\": 839000000, \"year\": 1990}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.4551, \"life_expect\": 61.765, \"pop\": 927000000, \"year\": 1995}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 2.8073, \"life_expect\": 64.698, \"pop\": 1080264388, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.672, \"life_expect\": 39.918, \"pop\": 86807000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.62, \"life_expect\": 42.518, \"pop\": 95254000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.568, \"life_expect\": 45.964, \"pop\": 105093000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.3, \"life_expect\": 49.203, \"pop\": 116044000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.73, \"life_expect\": 52.702, \"pop\": 130297000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.109, \"life_expect\": 56.159, \"pop\": 146995000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 3.4, \"life_expect\": 60.137, \"pop\": 163403000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.9, \"life_expect\": 62.681, \"pop\": 178500000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.55, \"life_expect\": 66.041, \"pop\": 194755000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.182, \"life_expect\": 70.65, \"pop\": 218465000, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 47.181, \"pop\": 18729000, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 49.325, \"pop\": 21577000, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.8, \"life_expect\": 52.469, \"pop\": 25000000, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.4, \"life_expect\": 55.234, \"pop\": 28933000, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.5, \"life_expect\": 57.702, \"pop\": 33379000, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.63, \"life_expect\": 59.62, \"pop\": 39583397, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 5.62, \"life_expect\": 63.04, \"pop\": 48439952, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 4.328, \"life_expect\": 65.742, \"pop\": 57035717, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.534, \"life_expect\": 68.042, \"pop\": 61628116, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.04, \"life_expect\": 70.964, \"pop\": 68017860, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.3, \"life_expect\": 48.437, \"pop\": 5903253, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.25, \"life_expect\": 51.457, \"pop\": 6822030, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.2, \"life_expect\": 54.459, \"pop\": 7970746, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.15, \"life_expect\": 56.95, \"pop\": 9413671, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.8, \"life_expect\": 60.413, \"pop\": 11117804, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.35, \"life_expect\": 62.038, \"pop\": 13232839, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.15, \"life_expect\": 65.044, \"pop\": 15693620, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.7, \"life_expect\": 59.461, \"pop\": 18134702, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.37, \"life_expect\": 58.811, \"pop\": 19557247, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.264, \"life_expect\": 59.545, \"pop\": 26074906, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.68, \"life_expect\": 68.9, \"pop\": 2916133, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.979, \"life_expect\": 70.29, \"pop\": 2832000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.873, \"life_expect\": 71.08, \"pop\": 2876000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.815, \"life_expect\": 71.28, \"pop\": 2950100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.478, \"life_expect\": 72.03, \"pop\": 3177300, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.877, \"life_expect\": 73.1, \"pop\": 3401000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.287, \"life_expect\": 74.36, \"pop\": 3540000, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 75.467, \"pop\": 3508200, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9, \"life_expect\": 76.122, \"pop\": 3613890, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.964, \"life_expect\": 78.885, \"pop\": 4015676, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.893, \"life_expect\": 67.84, \"pop\": 1772032, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.852, \"life_expect\": 69.39, \"pop\": 2141495, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.79, \"life_expect\": 70.75, \"pop\": 2578184, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.77, \"life_expect\": 71.63, \"pop\": 2903434, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.409, \"life_expect\": 73.06, \"pop\": 3354242, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.125, \"life_expect\": 74.45, \"pop\": 3737473, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.051, \"life_expect\": 75.6, \"pop\": 4074965, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.933, \"life_expect\": 76.93, \"pop\": 4512068, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.942, \"life_expect\": 78.269, \"pop\": 5305120, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.75, \"life_expect\": 80.745, \"pop\": 6276883, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.35, \"life_expect\": 67.81, \"pop\": 48633000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.498, \"life_expect\": 69.24, \"pop\": 50197600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.493, \"life_expect\": 71.06, \"pop\": 51987100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.325, \"life_expect\": 72.19, \"pop\": 53661100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.889, \"life_expect\": 73.48, \"pop\": 55571894, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.53, \"life_expect\": 74.98, \"pop\": 56451247, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.349, \"life_expect\": 76.42, \"pop\": 56731215, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.275, \"life_expect\": 77.44, \"pop\": 56742886, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.213, \"life_expect\": 78.82, \"pop\": 57274531, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.379, \"life_expect\": 80.546, \"pop\": 58103033, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.08, \"life_expect\": 62.61, \"pop\": 1488805, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.64, \"life_expect\": 65.61, \"pop\": 1631784, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.78, \"life_expect\": 67.51, \"pop\": 1777397, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.0, \"life_expect\": 69.0, \"pop\": 1943787, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 4.0, \"life_expect\": 70.11, \"pop\": 2104879, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.55, \"life_expect\": 71.21, \"pop\": 2228803, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.1, \"life_expect\": 71.77, \"pop\": 2318652, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.84, \"life_expect\": 71.766, \"pop\": 2347922, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.67, \"life_expect\": 72.262, \"pop\": 2469389, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.4289, \"life_expect\": 72.567, \"pop\": 2735520, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.08, \"life_expect\": 65.5, \"pop\": 89815060, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.02, \"life_expect\": 68.73, \"pop\": 94091638, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.0, \"life_expect\": 71.43, \"pop\": 98882534, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.07, \"life_expect\": 73.42, \"pop\": 104344973, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.81, \"life_expect\": 75.38, \"pop\": 111573116, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.76, \"life_expect\": 77.11, \"pop\": 116807309, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.6600000000000001, \"life_expect\": 78.67, \"pop\": 120754335, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.49, \"life_expect\": 79.36, \"pop\": 123537399, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.3900000000000001, \"life_expect\": 80.69, \"pop\": 125341354, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.27, \"life_expect\": 82.603, \"pop\": 127417244, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.816, \"life_expect\": 44.686, \"pop\": 7033999, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 47.949, \"pop\": 8156827, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 50.654, \"pop\": 9549179, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.0, \"life_expect\": 53.559, \"pop\": 11247182, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.6, \"life_expect\": 56.155, \"pop\": 13433414, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.2, \"life_expect\": 58.766, \"pop\": 16331401, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 6.5, \"life_expect\": 59.339, \"pop\": 19763285, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.4, \"life_expect\": 59.285, \"pop\": 23358413, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 54.407, \"pop\": 27060142, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 4.959, \"life_expect\": 54.11, \"pop\": 33829590, \"year\": 2005}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.8, \"life_expect\": 54.081, \"pop\": 8839427, \"year\": 1955}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.41, \"life_expect\": 56.656, \"pop\": 10391909, \"year\": 1960}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 4.09, \"life_expect\": 59.942, \"pop\": 11868751, \"year\": 1965}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.7199999999999998, \"life_expect\": 63.983, \"pop\": 13911902, \"year\": 1970}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.58, \"life_expect\": 67.159, \"pop\": 15801308, \"year\": 1975}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.93, \"life_expect\": 69.1, \"pop\": 17113626, \"year\": 1980}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.45, \"life_expect\": 70.647, \"pop\": 18481420, \"year\": 1985}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.35, \"life_expect\": 69.978, \"pop\": 20018546, \"year\": 1990}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.0938, \"life_expect\": 67.727, \"pop\": 21561856, \"year\": 1995}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.85, \"life_expect\": 67.297, \"pop\": 22912177, \"year\": 2005}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 6.332, \"life_expect\": 52.681, \"pop\": 21551834, \"year\": 1955}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 5.63, \"life_expect\": 55.292, \"pop\": 24784140, \"year\": 1960}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.708, \"life_expect\": 57.716, \"pop\": 28705000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.281, \"life_expect\": 62.612, \"pop\": 32241000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.919, \"life_expect\": 64.766, \"pop\": 35281000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.234, \"life_expect\": 67.123, \"pop\": 38124000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.601, \"life_expect\": 69.81, \"pop\": 40806000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.6960000000000002, \"life_expect\": 72.244, \"pop\": 42869000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.514, \"life_expect\": 74.647, \"pop\": 45264146, \"year\": 1995}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.21, \"life_expect\": 78.623, \"pop\": 48640671, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.72, \"life_expect\": 59.489, \"pop\": 1560985, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.689, \"life_expect\": 62.094, \"pop\": 1786235, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.336, \"life_expect\": 63.87, \"pop\": 2057945, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.78, \"life_expect\": 65.421, \"pop\": 2383029, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.311, \"life_expect\": 66.099, \"pop\": 3098159, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.895, \"life_expect\": 66.983, \"pop\": 3085876, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.313, \"life_expect\": 67.926, \"pop\": 3088235, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.0, \"life_expect\": 69.292, \"pop\": 3147267, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.6950000000000003, \"life_expect\": 70.265, \"pop\": 3334733, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.209, \"life_expect\": 71.993, \"pop\": 3826018, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.095, \"life_expect\": 72.99, \"pop\": 10750842, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.168, \"life_expect\": 73.23, \"pop\": 11486000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.797, \"life_expect\": 73.82, \"pop\": 12292000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.059, \"life_expect\": 73.75, \"pop\": 13032335, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.596, \"life_expect\": 75.24, \"pop\": 13653438, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5150000000000001, \"life_expect\": 76.05, \"pop\": 14143901, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5550000000000002, \"life_expect\": 76.83, \"pop\": 14491380, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.583, \"life_expect\": 77.42, \"pop\": 14951510, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.6, \"life_expect\": 78.03, \"pop\": 15459054, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.721, \"life_expect\": 79.762, \"pop\": 16407491, \"year\": 2005}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.07, \"life_expect\": 70.26, \"pop\": 2136168, \"year\": 1955}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.022, \"life_expect\": 71.24, \"pop\": 2371746, \"year\": 1960}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 3.348, \"life_expect\": 71.52, \"pop\": 2640400, \"year\": 1965}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.843, \"life_expect\": 71.89, \"pop\": 2828050, \"year\": 1970}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.178, \"life_expect\": 72.22, \"pop\": 3117800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.963, \"life_expect\": 73.84, \"pop\": 3170150, \"year\": 1980}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.053, \"life_expect\": 74.32, \"pop\": 3298050, \"year\": 1985}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.061, \"life_expect\": 76.33, \"pop\": 3359604, \"year\": 1990}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.952, \"life_expect\": 77.55, \"pop\": 3565990, \"year\": 1995}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.994, \"life_expect\": 80.204, \"pop\": 4035461, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 37.802, \"pop\": 35458978, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 39.36, \"pop\": 39914593, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 41.04, \"pop\": 45020052, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 42.821, \"pop\": 51027516, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 44.514, \"pop\": 58522112, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 45.826, \"pop\": 68550274, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.834, \"life_expect\": 46.886, \"pop\": 77573154, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.635, \"life_expect\": 47.472, \"pop\": 88510354, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.246, \"life_expect\": 47.464, \"pop\": 100960105, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.322, \"life_expect\": 46.859, \"pop\": 128765768, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.8369999999999997, \"life_expect\": 73.44, \"pop\": 3427409, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.898, \"life_expect\": 73.47, \"pop\": 3581239, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.719, \"life_expect\": 74.08, \"pop\": 3723153, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.248, \"life_expect\": 74.34, \"pop\": 3877386, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.81, \"life_expect\": 75.37, \"pop\": 4007313, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.687, \"life_expect\": 75.97, \"pop\": 4085620, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8, \"life_expect\": 75.89, \"pop\": 4152419, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8860000000000001, \"life_expect\": 77.32, \"pop\": 4242006, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.853, \"life_expect\": 78.32, \"pop\": 4359101, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8479999999999999, \"life_expect\": 80.196, \"pop\": 4593041, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 45.557, \"pop\": 44434445, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 47.67, \"pop\": 50386898, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 49.8, \"pop\": 57494940, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 51.929, \"pop\": 65705964, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 54.043, \"pop\": 74711541, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 56.158, \"pop\": 85219117, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.66, \"life_expect\": 58.245, \"pop\": 99060352, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 5.8, \"life_expect\": 60.838, \"pop\": 114578478, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 4.9596, \"life_expect\": 61.818, \"pop\": 128690285, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.5211, \"life_expect\": 65.483, \"pop\": 162419946, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 46.263, \"pop\": 8671500, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 49.096, \"pop\": 9931000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.5600000000000005, \"life_expect\": 51.445, \"pop\": 11467300, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.0, \"life_expect\": 55.448, \"pop\": 13192800, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 5.378, \"life_expect\": 58.447, \"pop\": 15161199, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.65, \"life_expect\": 61.406, \"pop\": 17295298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.1, \"life_expect\": 64.134, \"pop\": 19348926, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.7, \"life_expect\": 66.458, \"pop\": 21511443, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.0995, \"life_expect\": 68.386, \"pop\": 23846388, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.5065, \"life_expect\": 71.421, \"pop\": 27925628, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 7.13, \"life_expect\": 51.334, \"pop\": 24553055, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.85, \"life_expect\": 54.757, \"pop\": 28528939, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.5, \"life_expect\": 56.393, \"pop\": 33267569, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.0, \"life_expect\": 58.065, \"pop\": 38603696, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 5.5, \"life_expect\": 60.06, \"pop\": 44336842, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.95, \"life_expect\": 62.082, \"pop\": 50940182, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.55, \"life_expect\": 64.151, \"pop\": 57288037, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.143, \"life_expect\": 66.458, \"pop\": 64318120, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.7248, \"life_expect\": 68.564, \"pop\": 71717437, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.2327, \"life_expect\": 71.688, \"pop\": 87857473, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 3.29, \"life_expect\": 65.77, \"pop\": 27220668, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.65, \"life_expect\": 67.64, \"pop\": 29589842, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.27, \"life_expect\": 69.61, \"pop\": 31262358, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.25, \"life_expect\": 70.85, \"pop\": 32526000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.26, \"life_expect\": 70.67, \"pop\": 33969240, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.33, \"life_expect\": 71.32, \"pop\": 35578016, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.15, \"life_expect\": 70.98, \"pop\": 37225792, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.8900000000000001, \"life_expect\": 70.99, \"pop\": 38119408, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.478, \"life_expect\": 72.75, \"pop\": 38600642, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.227, \"life_expect\": 75.563, \"pop\": 38557984, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.03, \"life_expect\": 61.51, \"pop\": 8692600, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.074, \"life_expect\": 64.39, \"pop\": 9036700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.849, \"life_expect\": 66.6, \"pop\": 9128850, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.748, \"life_expect\": 69.26, \"pop\": 9044200, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.41, \"life_expect\": 70.41, \"pop\": 9411090, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.982, \"life_expect\": 72.77, \"pop\": 9777800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.5939999999999999, \"life_expect\": 74.06, \"pop\": 9897192, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.516, \"life_expect\": 74.86, \"pop\": 9922689, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.475, \"life_expect\": 75.97, \"pop\": 10065543, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.455, \"life_expect\": 78.098, \"pop\": 10566212, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.0, \"life_expect\": 41.5, \"pop\": 2698272, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.1, \"life_expect\": 43.0, \"pop\": 3031804, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.2, \"life_expect\": 44.1, \"pop\": 3264640, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.29, \"life_expect\": 44.6, \"pop\": 3769171, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.492, \"life_expect\": 45.0, \"pop\": 4356863, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.5, \"life_expect\": 46.218, \"pop\": 5138689, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.25, \"life_expect\": 44.02, \"pop\": 6009833, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.9, \"life_expect\": 23.599, \"pop\": 6923738, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.0993, \"life_expect\": 36.087, \"pop\": 5706501, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 5.9169, \"life_expect\": 46.242, \"pop\": 8440820, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.175, \"life_expect\": 42.868, \"pop\": 4243218, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 45.914, \"pop\": 4718301, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 49.901, \"pop\": 5327432, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.298, \"life_expect\": 53.886, \"pop\": 6109051, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.2780000000000005, \"life_expect\": 58.69, \"pop\": 7204820, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.015, \"life_expect\": 63.012, \"pop\": 9999161, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 6.217, \"life_expect\": 66.295, \"pop\": 13330067, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 5.446, \"life_expect\": 68.768, \"pop\": 16060761, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 4.621, \"life_expect\": 70.533, \"pop\": 19966998, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.352, \"life_expect\": 72.777, \"pop\": 26417599, \"year\": 2005}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.5, \"life_expect\": 47.985, \"pop\": 15368551, \"year\": 1955}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.3, \"life_expect\": 49.951, \"pop\": 17416653, \"year\": 1960}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.7, \"life_expect\": 51.927, \"pop\": 19898242, \"year\": 1965}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.47, \"life_expect\": 53.696, \"pop\": 22739921, \"year\": 1970}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.0, \"life_expect\": 55.527, \"pop\": 25815144, \"year\": 1975}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 4.556, \"life_expect\": 58.161, \"pop\": 29251588, \"year\": 1980}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.85, \"life_expect\": 60.834, \"pop\": 34254092, \"year\": 1985}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.343, \"life_expect\": 61.888, \"pop\": 38391094, \"year\": 1990}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.954, \"life_expect\": 60.236, \"pop\": 41779149, \"year\": 1995}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.637, \"life_expect\": 49.339, \"pop\": 44344136, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.75, \"life_expect\": 66.66, \"pop\": 29318745, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.89, \"life_expect\": 69.69, \"pop\": 30641187, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.92, \"life_expect\": 71.44, \"pop\": 32084511, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.86, \"life_expect\": 73.06, \"pop\": 33876479, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.5700000000000003, \"life_expect\": 74.39, \"pop\": 35563535, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.8900000000000001, \"life_expect\": 76.3, \"pop\": 37488360, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.48, \"life_expect\": 76.9, \"pop\": 38534853, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.27, \"life_expect\": 77.57, \"pop\": 39350769, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.182, \"life_expect\": 78.77, \"pop\": 39749715, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.409, \"life_expect\": 80.941, \"pop\": 40341462, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.34, \"life_expect\": 70.56, \"pop\": 4980000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.51, \"life_expect\": 71.32, \"pop\": 5362000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.27, \"life_expect\": 72.77, \"pop\": 5943000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.82, \"life_expect\": 73.78, \"pop\": 6267000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 75.39, \"pop\": 6403500, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 76.21, \"pop\": 6385229, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 77.41, \"pop\": 6563770, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.54, \"life_expect\": 78.03, \"pop\": 6836626, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.47, \"life_expect\": 79.37, \"pop\": 7157106, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.42, \"life_expect\": 81.701, \"pop\": 7489370, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.6, \"life_expect\": 48.079, \"pop\": 24144571, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.19, \"life_expect\": 52.098, \"pop\": 28217122, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.7, \"life_expect\": 54.336, \"pop\": 31950718, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.3, \"life_expect\": 57.005, \"pop\": 35758382, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.715, \"life_expect\": 59.507, \"pop\": 40529798, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.15, \"life_expect\": 61.036, \"pop\": 45120802, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 3.276, \"life_expect\": 63.108, \"pop\": 50669003, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.904, \"life_expect\": 66.146, \"pop\": 56084632, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.574, \"life_expect\": 68.835, \"pop\": 61188984, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.143, \"life_expect\": 71.777, \"pop\": 69660559, \"year\": 2005}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.49, \"life_expect\": 70.42, \"pop\": 50946000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.81, \"life_expect\": 70.76, \"pop\": 52372000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.52, \"life_expect\": 71.36, \"pop\": 54350000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.04, \"life_expect\": 72.01, \"pop\": 55632000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.72, \"life_expect\": 72.76, \"pop\": 56215000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.8, \"life_expect\": 74.04, \"pop\": 56314000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.81, \"life_expect\": 75.007, \"pop\": 56620240, \"year\": 1985}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.78, \"life_expect\": 76.42, \"pop\": 57493307, \"year\": 1990}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.7000000000000002, \"life_expect\": 77.218, \"pop\": 58426014, \"year\": 1995}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.815, \"life_expect\": 79.425, \"pop\": 60441457, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.4585, \"life_expect\": 57.907, \"pop\": 6170497, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.657, \"life_expect\": 60.77, \"pop\": 7556483, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 5.9045000000000005, \"life_expect\": 63.479, \"pop\": 9067735, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.941, \"life_expect\": 65.712, \"pop\": 10758017, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.4685, \"life_expect\": 67.456, \"pop\": 12674987, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.957, \"life_expect\": 68.557, \"pop\": 14767890, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.6485000000000003, \"life_expect\": 70.19, \"pop\": 16997509, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.25, \"life_expect\": 71.15, \"pop\": 19325222, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.9415, \"life_expect\": 72.146, \"pop\": 21555902, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.547, \"life_expect\": 73.747, \"pop\": 25375281, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data).mark_line().encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('fertility:Q'),\n",
    "    alt.Color('country:N', legend=None),\n",
    "    alt.Tooltip('country:N')\n",
    ").properties(\n",
    "    width=400\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "qmV54UhSMPxU"
   },
   "source": [
    "We can see interesting variations per country, but overall trends for lower numbers of children per family over time. Also note that we set a custom width of 400 pixels. _Try changing (or removing) the widths and see what happens!_\n",
    "\n",
    "Let's change some of the default mark parameters to customize the plot. We can set the `strokeWidth` to determine the thickness of the lines and the `opacity` to add some transparency. By default, the `line` mark uses straight line segments to connect data points. In some cases we might want to smooth the lines. We can adjust the interpolation used to connect data points by setting the `interpolate` mark parameter. Let's use `'monotone'` interpolation to provide smooth lines that are also guaranteed not to inadvertently generate \"false\" minimum or maximum values as a result of the interpolation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "PbdSZMs43rgW",
    "outputId": "07007338-a2c7-4dc2-9f36-bb344e4103ec"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-03b29f53682d416c80347b979889d53e\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-03b29f53682d416c80347b979889d53e\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-89be1acdd14c7effd56f4dd0fabf92c3\"}, \"mark\": {\"type\": \"line\", \"interpolate\": \"monotone\", \"opacity\": 0.5, \"strokeWidth\": 3}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\", \"legend\": null}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"fertility\"}}, \"width\": 400, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-89be1acdd14c7effd56f4dd0fabf92c3\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 30.332, \"pop\": 8891209, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 31.997, \"pop\": 9829450, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 34.02, \"pop\": 10997885, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 36.088, \"pop\": 12430623, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 38.438, \"pop\": 14132019, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.8, \"life_expect\": 39.854, \"pop\": 15112149, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.9, \"life_expect\": 40.822, \"pop\": 13796928, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.674, \"pop\": 14669339, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 8.0, \"life_expect\": 41.763, \"pop\": 20881480, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.4792, \"life_expect\": 42.129, \"pop\": 23898198, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.0685, \"life_expect\": 43.828, \"pop\": 29928987, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1265, \"life_expect\": 64.399, \"pop\": 18927821, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.0895, \"life_expect\": 65.142, \"pop\": 20616009, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.049, \"life_expect\": 65.634, \"pop\": 22283100, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1455, \"life_expect\": 67.065, \"pop\": 23962313, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.44, \"life_expect\": 68.481, \"pop\": 26081880, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.15, \"life_expect\": 69.942, \"pop\": 28369799, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.053, \"life_expect\": 70.774, \"pop\": 30675059, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.9, \"life_expect\": 71.868, \"pop\": 33022202, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.63, \"life_expect\": 73.275, \"pop\": 35311049, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.35, \"life_expect\": 74.34, \"pop\": 37497728, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.254, \"life_expect\": 75.32, \"pop\": 39537943, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 5.15, \"life_expect\": 64.381, \"pop\": 53865, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 4.399, \"life_expect\": 66.606, \"pop\": 57203, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 3.301, \"life_expect\": 68.336, \"pop\": 59020, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.651, \"life_expect\": 70.941, \"pop\": 59039, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.45, \"life_expect\": 71.83, \"pop\": 59390, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.358, \"life_expect\": 74.116, \"pop\": 60266, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.3, \"life_expect\": 74.494, \"pop\": 64129, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.2800000000000002, \"life_expect\": 74.108, \"pop\": 66653, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.208, \"life_expect\": 73.011, \"pop\": 67836, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.124, \"life_expect\": 73.451, \"pop\": 69539, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.04, \"life_expect\": 74.239, \"pop\": 71566, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.406, \"life_expect\": 70.33, \"pop\": 9277087, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.274, \"life_expect\": 70.93, \"pop\": 10361273, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.871, \"life_expect\": 71.1, \"pop\": 11439384, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 2.535, \"life_expect\": 71.93, \"pop\": 12660160, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.9889999999999999, \"life_expect\": 73.49, \"pop\": 13771400, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.907, \"life_expect\": 74.74, \"pop\": 14615900, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.859, \"life_expect\": 76.32, \"pop\": 15788300, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.8599999999999999, \"life_expect\": 77.56, \"pop\": 17022133, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.776, \"life_expect\": 78.83, \"pop\": 18116171, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.756, \"life_expect\": 80.37, \"pop\": 19164620, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.788, \"life_expect\": 81.235, \"pop\": 20090437, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.52, \"life_expect\": 67.48, \"pop\": 6946885, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.7800000000000002, \"life_expect\": 69.54, \"pop\": 7047437, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.5300000000000002, \"life_expect\": 70.14, \"pop\": 7270889, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.02, \"life_expect\": 70.63, \"pop\": 7467086, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.6400000000000001, \"life_expect\": 72.17, \"pop\": 7578903, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.62, \"life_expect\": 73.18, \"pop\": 7549433, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.45, \"life_expect\": 74.94, \"pop\": 7559776, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.47, \"life_expect\": 76.04, \"pop\": 7722953, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.388, \"life_expect\": 77.51, \"pop\": 8047433, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.3820000000000001, \"life_expect\": 78.98, \"pop\": 8113413, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.42, \"life_expect\": 79.829, \"pop\": 8184691, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.305, \"life_expect\": 62.405, \"pop\": 87138, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.503, \"life_expect\": 64.209, \"pop\": 112234, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.794, \"life_expect\": 65.795, \"pop\": 139205, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.444, \"life_expect\": 66.515, \"pop\": 170323, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.221, \"life_expect\": 67.199, \"pop\": 189139, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 3.16, \"life_expect\": 67.874, \"pop\": 209944, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.62, \"life_expect\": 69.524, \"pop\": 234988, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.6, \"life_expect\": 69.171, \"pop\": 257253, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.4, \"life_expect\": 68.472, \"pop\": 275303, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.1111, \"life_expect\": 71.068, \"pop\": 290075, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.0221, \"life_expect\": 73.495, \"pop\": 301790, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.76, \"life_expect\": 39.348, \"pop\": 49601520, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.85, \"life_expect\": 41.216, \"pop\": 54621538, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.6, \"life_expect\": 43.453, \"pop\": 60332117, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.15, \"life_expect\": 45.252, \"pop\": 67402621, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.6, \"life_expect\": 46.923, \"pop\": 76253310, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 5.25, \"life_expect\": 50.009, \"pop\": 88076996, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.629, \"life_expect\": 52.819, \"pop\": 99752733, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 4.117, \"life_expect\": 56.018, \"pop\": 109896945, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.5042999999999997, \"life_expect\": 59.412, \"pop\": 119186448, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 3.224, \"life_expect\": 62.013, \"pop\": 130406594, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 2.826, \"life_expect\": 64.062, \"pop\": 144319628, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.67, \"life_expect\": 62.57, \"pop\": 227255, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.26, \"life_expect\": 65.87, \"pop\": 232339, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 3.45, \"life_expect\": 67.62, \"pop\": 234980, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.74, \"life_expect\": 69.42, \"pop\": 238756, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 2.19, \"life_expect\": 71.27, \"pop\": 247147, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.92, \"life_expect\": 72.695, \"pop\": 251966, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.75, \"life_expect\": 74.027, \"pop\": 257446, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.6, \"life_expect\": 74.894, \"pop\": 262624, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 74.912, \"pop\": 267907, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 75.97, \"pop\": 273483, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 77.296, \"pop\": 278870, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.496, \"life_expect\": 69.24, \"pop\": 8868475, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.644, \"life_expect\": 70.25, \"pop\": 9118700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.392, \"life_expect\": 70.94, \"pop\": 9448100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.015, \"life_expect\": 71.44, \"pop\": 9637800, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.705, \"life_expect\": 72.8, \"pop\": 9794800, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.595, \"life_expect\": 73.93, \"pop\": 9846800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.5590000000000002, \"life_expect\": 75.35, \"pop\": 9858200, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.613, \"life_expect\": 76.46, \"pop\": 9969310, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.604, \"life_expect\": 77.53, \"pop\": 10155459, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.638, \"life_expect\": 78.32, \"pop\": 10263618, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.646, \"life_expect\": 79.441, \"pop\": 10364388, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.75, \"life_expect\": 41.89, \"pop\": 3074311, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.63, \"life_expect\": 43.428, \"pop\": 3434073, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5600000000000005, \"life_expect\": 45.032, \"pop\": 3853315, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.5, \"life_expect\": 46.714, \"pop\": 4346218, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.8, \"life_expect\": 50.023, \"pop\": 4914316, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.2995, \"life_expect\": 53.859, \"pop\": 5441298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 5.0, \"life_expect\": 57.251, \"pop\": 5934935, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.8, \"life_expect\": 59.957, \"pop\": 6573900, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 4.324, \"life_expect\": 62.05, \"pop\": 7376582, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.9585, \"life_expect\": 63.883, \"pop\": 8152620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.5, \"life_expect\": 65.554, \"pop\": 8857870, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 53.285, \"pop\": 61773546, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 55.665, \"pop\": 71694810, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 5.38, \"life_expect\": 57.632, \"pop\": 83092908, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.7175, \"life_expect\": 59.504, \"pop\": 95684297, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 4.305, \"life_expect\": 61.489, \"pop\": 108823732, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.8, \"life_expect\": 63.336, \"pop\": 122958132, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 3.1, \"life_expect\": 65.205, \"pop\": 137302933, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.6, \"life_expect\": 67.057, \"pop\": 151083809, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.45, \"life_expect\": 69.388, \"pop\": 163542501, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.345, \"life_expect\": 71.006, \"pop\": 175552771, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.245, \"life_expect\": 72.39, \"pop\": 186112794, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.486, \"life_expect\": 56.074, \"pop\": 6743269, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.4385, \"life_expect\": 57.924, \"pop\": 7585349, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 4.4405, \"life_expect\": 60.523, \"pop\": 8509950, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 3.63, \"life_expect\": 63.441, \"pop\": 9368558, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.803, \"life_expect\": 67.052, \"pop\": 10251542, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.6710000000000003, \"life_expect\": 70.565, \"pop\": 11093718, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.65, \"life_expect\": 72.492, \"pop\": 12066701, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.55, \"life_expect\": 74.126, \"pop\": 13127760, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.21, \"life_expect\": 75.816, \"pop\": 14205449, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 2.0, \"life_expect\": 77.86, \"pop\": 15153450, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 1.944, \"life_expect\": 78.553, \"pop\": 15980912, \"year\": 2005}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.59, \"life_expect\": 50.54896, \"pop\": 608655000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.72, \"life_expect\": 44.50136, \"pop\": 667070000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 6.06, \"life_expect\": 58.38112, \"pop\": 715185000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 4.86, \"life_expect\": 63.11888, \"pop\": 818315000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 3.32, \"life_expect\": 63.96736, \"pop\": 916395000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.55, \"life_expect\": 65.525, \"pop\": 981235000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 2.46, \"life_expect\": 67.274, \"pop\": 1051040000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.92, \"life_expect\": 68.69, \"pop\": 1135185000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7810000000000001, \"life_expect\": 70.426, \"pop\": 1204855000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.7000000000000002, \"life_expect\": 72.028, \"pop\": 1262645000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.725, \"life_expect\": 72.961, \"pop\": 1303182268, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 55.118, \"pop\": 13588405, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 57.863, \"pop\": 15952727, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.18, \"life_expect\": 59.963, \"pop\": 18646175, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 5.0005, \"life_expect\": 61.623, \"pop\": 21429658, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 4.3385, \"life_expect\": 63.837, \"pop\": 24114177, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.685, \"life_expect\": 66.653, \"pop\": 26582811, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 3.172, \"life_expect\": 67.768, \"pop\": 29678395, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.93005, \"life_expect\": 68.421, \"pop\": 32858579, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.7, \"life_expect\": 70.313, \"pop\": 36280883, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.4705, \"life_expect\": 71.682, \"pop\": 39685655, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.2205, \"life_expect\": 72.889, \"pop\": 42954279, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.1135, \"life_expect\": 60.026, \"pop\": 1031782, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.2245, \"life_expect\": 62.842, \"pop\": 1248022, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 5.801, \"life_expect\": 65.424, \"pop\": 1487605, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 4.346, \"life_expect\": 67.849, \"pop\": 1735523, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.7755, \"life_expect\": 70.75, \"pop\": 1991580, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.527, \"life_expect\": 73.45, \"pop\": 2299124, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 3.374, \"life_expect\": 74.752, \"pop\": 2643808, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.9450000000000003, \"life_expect\": 75.713, \"pop\": 3027175, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.5835, \"life_expect\": 77.26, \"pop\": 3383786, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.2815, \"life_expect\": 78.123, \"pop\": 3710558, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.0985, \"life_expect\": 78.782, \"pop\": 4016173, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.42, \"life_expect\": 64.77, \"pop\": 3955526, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.27, \"life_expect\": 67.13, \"pop\": 4036145, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.09, \"life_expect\": 68.5, \"pop\": 4133313, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 69.61, \"pop\": 4205389, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.02, \"life_expect\": 70.64, \"pop\": 4255000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.96, \"life_expect\": 70.46, \"pop\": 4383000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.8399999999999999, \"life_expect\": 71.52, \"pop\": 4457874, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.52, \"life_expect\": 72.527, \"pop\": 4508347, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.537, \"life_expect\": 73.68, \"pop\": 4496683, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.348, \"life_expect\": 74.876, \"pop\": 4410830, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.346, \"life_expect\": 75.748, \"pop\": 4495904, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6995, \"life_expect\": 62.325, \"pop\": 6381106, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.6805, \"life_expect\": 65.246, \"pop\": 7027210, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 4.3, \"life_expect\": 68.29, \"pop\": 7809916, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6, \"life_expect\": 70.723, \"pop\": 8542746, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 2.15, \"life_expect\": 72.649, \"pop\": 9290074, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 73.717, \"pop\": 9652975, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.8495, \"life_expect\": 74.174, \"pop\": 10078658, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6505, \"life_expect\": 74.414, \"pop\": 10544793, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.6095000000000002, \"life_expect\": 76.151, \"pop\": 10896802, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.63, \"life_expect\": 77.158, \"pop\": 11134273, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.49, \"life_expect\": 78.273, \"pop\": 11346670, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.6405, \"life_expect\": 49.828, \"pop\": 2737257, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.3505, \"life_expect\": 53.459, \"pop\": 3231488, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 6.6495, \"life_expect\": 56.751, \"pop\": 3805881, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 5.71, \"life_expect\": 59.631, \"pop\": 4422755, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.76, \"life_expect\": 61.788, \"pop\": 5048499, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 4.0, \"life_expect\": 63.727, \"pop\": 5696855, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.47, \"life_expect\": 66.046, \"pop\": 6377765, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.1995, \"life_expect\": 68.457, \"pop\": 7077651, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 3.05, \"life_expect\": 69.957, \"pop\": 7730224, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.95, \"life_expect\": 70.847, \"pop\": 8385828, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.81, \"life_expect\": 72.235, \"pop\": 9049595, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 51.356, \"pop\": 3842399, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 54.64, \"pop\": 4415956, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.5, \"life_expect\": 56.678, \"pop\": 5117779, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.0005, \"life_expect\": 58.796, \"pop\": 5939246, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 5.4005, \"life_expect\": 61.31, \"pop\": 6871698, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.7005, \"life_expect\": 64.342, \"pop\": 7920499, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 4.0, \"life_expect\": 67.231, \"pop\": 9061664, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.4005, \"life_expect\": 69.613, \"pop\": 10318036, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 3.1, \"life_expect\": 72.312, \"pop\": 11438004, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.8175, \"life_expect\": 74.173, \"pop\": 12505204, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.578, \"life_expect\": 74.994, \"pop\": 13363593, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.97, \"life_expect\": 44.444, \"pop\": 23855527, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 7.073, \"life_expect\": 46.992, \"pop\": 26846610, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.5600000000000005, \"life_expect\": 49.293, \"pop\": 30265148, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.855, \"life_expect\": 51.137, \"pop\": 33574026, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.609, \"life_expect\": 53.319, \"pop\": 36952499, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 5.332, \"life_expect\": 56.006, \"pop\": 42634215, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 4.833, \"life_expect\": 59.797, \"pop\": 50052381, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.908, \"life_expect\": 63.674, \"pop\": 56694413, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.5, \"life_expect\": 67.217, \"pop\": 63321615, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 3.174, \"life_expect\": 69.806, \"pop\": 70492342, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 2.891, \"life_expect\": 71.338, \"pop\": 77505756, \"year\": 2005}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8065, \"life_expect\": 48.57, \"pop\": 2221139, \"year\": 1955}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8469999999999995, \"life_expect\": 52.307, \"pop\": 2581583, \"year\": 1960}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.621, \"life_expect\": 55.855, \"pop\": 3017852, \"year\": 1965}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.0995, \"life_expect\": 58.207, \"pop\": 3603907, \"year\": 1970}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 5.5996, \"life_expect\": 56.696, \"pop\": 4071179, \"year\": 1975}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 4.5, \"life_expect\": 56.604, \"pop\": 4566199, \"year\": 1980}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.901, \"life_expect\": 63.154, \"pop\": 4664361, \"year\": 1985}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.52, \"life_expect\": 66.798, \"pop\": 5099884, \"year\": 1990}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 3.17, \"life_expect\": 69.535, \"pop\": 5568437, \"year\": 1995}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.883, \"life_expect\": 70.734, \"pop\": 6122515, \"year\": 2000}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.6825, \"life_expect\": 71.878, \"pop\": 6704932, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.769, \"life_expect\": 67.49, \"pop\": 4234900, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.66, \"life_expect\": 68.75, \"pop\": 4429600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.191, \"life_expect\": 69.83, \"pop\": 4563732, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.623, \"life_expect\": 70.87, \"pop\": 4606307, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.663, \"life_expect\": 72.52, \"pop\": 4711439, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.685, \"life_expect\": 74.55, \"pop\": 4779535, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.6600000000000001, \"life_expect\": 74.83, \"pop\": 4901783, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.819, \"life_expect\": 75.7, \"pop\": 4986431, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.7429999999999999, \"life_expect\": 77.13, \"pop\": 5104654, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.754, \"life_expect\": 78.37, \"pop\": 5168595, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.8250000000000002, \"life_expect\": 79.313, \"pop\": 5223442, \"year\": 2005}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.7119999999999997, \"life_expect\": 68.93, \"pop\": 43427669, \"year\": 1955}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.85, \"life_expect\": 70.51, \"pop\": 45670000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.607, \"life_expect\": 71.55, \"pop\": 48763000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.31, \"life_expect\": 72.38, \"pop\": 50787000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.862, \"life_expect\": 73.83, \"pop\": 52758427, \"year\": 1975}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.866, \"life_expect\": 74.89, \"pop\": 53869743, \"year\": 1980}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8050000000000002, \"life_expect\": 76.34, \"pop\": 55171224, \"year\": 1985}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.713, \"life_expect\": 77.46, \"pop\": 56735161, \"year\": 1990}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.7624, \"life_expect\": 78.64, \"pop\": 58149727, \"year\": 1995}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8833000000000002, \"life_expect\": 79.59, \"pop\": 59381628, \"year\": 2000}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8916, \"life_expect\": 80.657, \"pop\": 60656178, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.909, \"life_expect\": 62.625, \"pop\": 3827154, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.979, \"life_expect\": 64.644, \"pop\": 4146570, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.6109999999999998, \"life_expect\": 66.654, \"pop\": 4464959, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.601, \"life_expect\": 68.158, \"pop\": 4694491, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.39, \"life_expect\": 69.634, \"pop\": 4897656, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.269, \"life_expect\": 69.638, \"pop\": 5045697, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.263, \"life_expect\": 70.45, \"pop\": 5192957, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.9500000000000002, \"life_expect\": 70.465, \"pop\": 5426207, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.58, \"life_expect\": 70.49, \"pop\": 5012952, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.478, \"life_expect\": 70.476, \"pop\": 4777209, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.407, \"life_expect\": 70.987, \"pop\": 4677401, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.3, \"life_expect\": 69.1, \"pop\": 70195612, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.49, \"life_expect\": 70.3, \"pop\": 72480869, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.32, \"life_expect\": 70.8, \"pop\": 75638851, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.6400000000000001, \"life_expect\": 71.0, \"pop\": 77783164, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.52, \"life_expect\": 72.5, \"pop\": 78682325, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.46, \"life_expect\": 73.8, \"pop\": 78297904, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.43, \"life_expect\": 74.847, \"pop\": 77684907, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.31, \"life_expect\": 76.07, \"pop\": 79380394, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.34, \"life_expect\": 77.34, \"pop\": 81653702, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.346, \"life_expect\": 78.67, \"pop\": 82187909, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.3599999999999999, \"life_expect\": 79.406, \"pop\": 82431390, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.27, \"life_expect\": 67.86, \"pop\": 7965538, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.2, \"life_expect\": 69.51, \"pop\": 8327405, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.38, \"life_expect\": 71.0, \"pop\": 8550333, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 72.34, \"pop\": 8792806, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.32, \"life_expect\": 73.68, \"pop\": 9046542, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.96, \"life_expect\": 75.24, \"pop\": 9642505, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.53, \"life_expect\": 76.67, \"pop\": 9923253, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.37, \"life_expect\": 77.03, \"pop\": 10129603, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.296, \"life_expect\": 77.869, \"pop\": 10457554, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.2770000000000001, \"life_expect\": 78.256, \"pop\": 10559110, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.325, \"life_expect\": 79.483, \"pop\": 10668354, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.7, \"life_expect\": 63.114, \"pop\": 84621, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.4, \"life_expect\": 63.608, \"pop\": 90148, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.8, \"life_expect\": 64.091, \"pop\": 93290, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.6, \"life_expect\": 64.577, \"pop\": 95410, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.3, \"life_expect\": 65.035, \"pop\": 95819, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.23, \"life_expect\": 65.503, \"pop\": 90164, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 4.14, \"life_expect\": 66.002, \"pop\": 92203, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 3.26, \"life_expect\": 66.469, \"pop\": 92360, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.814, \"life_expect\": 66.986, \"pop\": 90603, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.429, \"life_expect\": 67.746, \"pop\": 89312, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.302, \"life_expect\": 68.724, \"pop\": 89502, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 40.696, \"pop\": 3376419, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 43.59, \"pop\": 3722743, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.0, \"life_expect\": 46.243, \"pop\": 4137405, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.6005, \"life_expect\": 48.042, \"pop\": 4604915, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.8, \"life_expect\": 49.923, \"pop\": 4828338, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.2099, \"life_expect\": 51.461, \"pop\": 5029725, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.69985, \"life_expect\": 53.636, \"pop\": 5517977, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 5.14985, \"life_expect\": 55.089, \"pop\": 6126101, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.61995, \"life_expect\": 56.671, \"pop\": 6675578, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 4.0, \"life_expect\": 58.137, \"pop\": 7306302, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 3.5445, \"life_expect\": 60.916, \"pop\": 8121622, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.72, \"life_expect\": 64.75, \"pop\": 2490400, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 5.31, \"life_expect\": 67.65, \"pop\": 3075300, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.02, \"life_expect\": 70.0, \"pop\": 3597900, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.89, \"life_expect\": 72.0, \"pop\": 3959000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 2.32, \"life_expect\": 73.6, \"pop\": 4395800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.8, \"life_expect\": 75.45, \"pop\": 5063100, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.31, \"life_expect\": 76.2, \"pop\": 5456200, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.288, \"life_expect\": 77.601, \"pop\": 5687959, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 1.08, \"life_expect\": 80.0, \"pop\": 6225347, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.9400000000000001, \"life_expect\": 81.495, \"pop\": 6658720, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.966, \"life_expect\": 82.208, \"pop\": 6898686, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 4.023, \"life_expect\": 73.47, \"pop\": 158044, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.943, \"life_expect\": 73.68, \"pop\": 175860, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 3.154, \"life_expect\": 73.73, \"pop\": 192288, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.843, \"life_expect\": 74.46, \"pop\": 204104, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.287, \"life_expect\": 76.11, \"pop\": 218031, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.248, \"life_expect\": 76.99, \"pop\": 228161, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.116, \"life_expect\": 77.23, \"pop\": 241403, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.194, \"life_expect\": 78.77, \"pop\": 254719, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.056, \"life_expect\": 78.95, \"pop\": 267527, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 1.9929999999999999, \"life_expect\": 80.5, \"pop\": 281043, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.052, \"life_expect\": 81.757, \"pop\": 296737, \"year\": 2005}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8961, \"life_expect\": 40.249, \"pop\": 393000000, \"year\": 1955}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8216, \"life_expect\": 43.605, \"pop\": 434000000, \"year\": 1960}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.6058, \"life_expect\": 47.193, \"pop\": 485000000, \"year\": 1965}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.264, \"life_expect\": 50.651, \"pop\": 541000000, \"year\": 1970}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.8888, \"life_expect\": 54.208, \"pop\": 607000000, \"year\": 1975}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.4975, \"life_expect\": 56.596, \"pop\": 679000000, \"year\": 1980}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 4.15, \"life_expect\": 58.553, \"pop\": 755000000, \"year\": 1985}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.8648, \"life_expect\": 60.223, \"pop\": 839000000, \"year\": 1990}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.4551, \"life_expect\": 61.765, \"pop\": 927000000, \"year\": 1995}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 3.1132, \"life_expect\": 62.879, \"pop\": 1007702000, \"year\": 2000}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 2.8073, \"life_expect\": 64.698, \"pop\": 1080264388, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.672, \"life_expect\": 39.918, \"pop\": 86807000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.62, \"life_expect\": 42.518, \"pop\": 95254000, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.568, \"life_expect\": 45.964, \"pop\": 105093000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.3, \"life_expect\": 49.203, \"pop\": 116044000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.73, \"life_expect\": 52.702, \"pop\": 130297000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 4.109, \"life_expect\": 56.159, \"pop\": 146995000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 3.4, \"life_expect\": 60.137, \"pop\": 163403000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.9, \"life_expect\": 62.681, \"pop\": 178500000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.55, \"life_expect\": 66.041, \"pop\": 194755000, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.3761, \"life_expect\": 68.588, \"pop\": 206265000, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.182, \"life_expect\": 70.65, \"pop\": 218465000, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 47.181, \"pop\": 18729000, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 49.325, \"pop\": 21577000, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.8, \"life_expect\": 52.469, \"pop\": 25000000, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.4, \"life_expect\": 55.234, \"pop\": 28933000, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.5, \"life_expect\": 57.702, \"pop\": 33379000, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 6.63, \"life_expect\": 59.62, \"pop\": 39583397, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 5.62, \"life_expect\": 63.04, \"pop\": 48439952, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 4.328, \"life_expect\": 65.742, \"pop\": 57035717, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.534, \"life_expect\": 68.042, \"pop\": 61628116, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.124, \"life_expect\": 69.451, \"pop\": 65660289, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.04, \"life_expect\": 70.964, \"pop\": 68017860, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.3, \"life_expect\": 48.437, \"pop\": 5903253, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.25, \"life_expect\": 51.457, \"pop\": 6822030, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.2, \"life_expect\": 54.459, \"pop\": 7970746, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.15, \"life_expect\": 56.95, \"pop\": 9413671, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.8, \"life_expect\": 60.413, \"pop\": 11117804, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.35, \"life_expect\": 62.038, \"pop\": 13232839, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 6.15, \"life_expect\": 65.044, \"pop\": 15693620, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.7, \"life_expect\": 59.461, \"pop\": 18134702, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 5.37, \"life_expect\": 58.811, \"pop\": 19557247, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.858, \"life_expect\": 57.046, \"pop\": 22675617, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.264, \"life_expect\": 59.545, \"pop\": 26074906, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.68, \"life_expect\": 68.9, \"pop\": 2916133, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.979, \"life_expect\": 70.29, \"pop\": 2832000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.873, \"life_expect\": 71.08, \"pop\": 2876000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.815, \"life_expect\": 71.28, \"pop\": 2950100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.478, \"life_expect\": 72.03, \"pop\": 3177300, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.877, \"life_expect\": 73.1, \"pop\": 3401000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 2.287, \"life_expect\": 74.36, \"pop\": 3540000, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 75.467, \"pop\": 3508200, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9, \"life_expect\": 76.122, \"pop\": 3613890, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.9689999999999999, \"life_expect\": 77.783, \"pop\": 3791690, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.964, \"life_expect\": 78.885, \"pop\": 4015676, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.893, \"life_expect\": 67.84, \"pop\": 1772032, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.852, \"life_expect\": 69.39, \"pop\": 2141495, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.79, \"life_expect\": 70.75, \"pop\": 2578184, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.77, \"life_expect\": 71.63, \"pop\": 2903434, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.409, \"life_expect\": 73.06, \"pop\": 3354242, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.125, \"life_expect\": 74.45, \"pop\": 3737473, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.051, \"life_expect\": 75.6, \"pop\": 4074965, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.933, \"life_expect\": 76.93, \"pop\": 4512068, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.942, \"life_expect\": 78.269, \"pop\": 5305120, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.906, \"life_expect\": 79.696, \"pop\": 5842454, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.75, \"life_expect\": 80.745, \"pop\": 6276883, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.35, \"life_expect\": 67.81, \"pop\": 48633000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.498, \"life_expect\": 69.24, \"pop\": 50197600, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.493, \"life_expect\": 71.06, \"pop\": 51987100, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.325, \"life_expect\": 72.19, \"pop\": 53661100, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.889, \"life_expect\": 73.48, \"pop\": 55571894, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.53, \"life_expect\": 74.98, \"pop\": 56451247, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.349, \"life_expect\": 76.42, \"pop\": 56731215, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.275, \"life_expect\": 77.44, \"pop\": 56742886, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.213, \"life_expect\": 78.82, \"pop\": 57274531, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.286, \"life_expect\": 80.24, \"pop\": 57719337, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.379, \"life_expect\": 80.546, \"pop\": 58103033, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.08, \"life_expect\": 62.61, \"pop\": 1488805, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.64, \"life_expect\": 65.61, \"pop\": 1631784, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.78, \"life_expect\": 67.51, \"pop\": 1777397, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.0, \"life_expect\": 69.0, \"pop\": 1943787, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 4.0, \"life_expect\": 70.11, \"pop\": 2104879, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.55, \"life_expect\": 71.21, \"pop\": 2228803, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 3.1, \"life_expect\": 71.77, \"pop\": 2318652, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.84, \"life_expect\": 71.766, \"pop\": 2347922, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.67, \"life_expect\": 72.262, \"pop\": 2469389, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.628, \"life_expect\": 72.047, \"pop\": 2615467, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.4289, \"life_expect\": 72.567, \"pop\": 2735520, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.08, \"life_expect\": 65.5, \"pop\": 89815060, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.02, \"life_expect\": 68.73, \"pop\": 94091638, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.0, \"life_expect\": 71.43, \"pop\": 98882534, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.07, \"life_expect\": 73.42, \"pop\": 104344973, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.81, \"life_expect\": 75.38, \"pop\": 111573116, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.76, \"life_expect\": 77.11, \"pop\": 116807309, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.6600000000000001, \"life_expect\": 78.67, \"pop\": 120754335, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.49, \"life_expect\": 79.36, \"pop\": 123537399, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.3900000000000001, \"life_expect\": 80.69, \"pop\": 125341354, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.291, \"life_expect\": 82.0, \"pop\": 126699784, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.27, \"life_expect\": 82.603, \"pop\": 127417244, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.816, \"life_expect\": 44.686, \"pop\": 7033999, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 47.949, \"pop\": 8156827, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.12, \"life_expect\": 50.654, \"pop\": 9549179, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 8.0, \"life_expect\": 53.559, \"pop\": 11247182, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.6, \"life_expect\": 56.155, \"pop\": 13433414, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.2, \"life_expect\": 58.766, \"pop\": 16331401, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 6.5, \"life_expect\": 59.339, \"pop\": 19763285, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.4, \"life_expect\": 59.285, \"pop\": 23358413, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 54.407, \"pop\": 27060142, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 5.0, \"life_expect\": 50.992, \"pop\": 29985839, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 4.959, \"life_expect\": 54.11, \"pop\": 33829590, \"year\": 2005}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.8, \"life_expect\": 54.081, \"pop\": 8839427, \"year\": 1955}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.41, \"life_expect\": 56.656, \"pop\": 10391909, \"year\": 1960}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 4.09, \"life_expect\": 59.942, \"pop\": 11868751, \"year\": 1965}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.7199999999999998, \"life_expect\": 63.983, \"pop\": 13911902, \"year\": 1970}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.58, \"life_expect\": 67.159, \"pop\": 15801308, \"year\": 1975}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.93, \"life_expect\": 69.1, \"pop\": 17113626, \"year\": 1980}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.45, \"life_expect\": 70.647, \"pop\": 18481420, \"year\": 1985}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.35, \"life_expect\": 69.978, \"pop\": 20018546, \"year\": 1990}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 2.0938, \"life_expect\": 67.727, \"pop\": 21561856, \"year\": 1995}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.9173, \"life_expect\": 66.662, \"pop\": 21647682, \"year\": 2000}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.85, \"life_expect\": 67.297, \"pop\": 22912177, \"year\": 2005}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 6.332, \"life_expect\": 52.681, \"pop\": 21551834, \"year\": 1955}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 5.63, \"life_expect\": 55.292, \"pop\": 24784140, \"year\": 1960}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.708, \"life_expect\": 57.716, \"pop\": 28705000, \"year\": 1965}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 4.281, \"life_expect\": 62.612, \"pop\": 32241000, \"year\": 1970}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.919, \"life_expect\": 64.766, \"pop\": 35281000, \"year\": 1975}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 2.234, \"life_expect\": 67.123, \"pop\": 38124000, \"year\": 1980}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.601, \"life_expect\": 69.81, \"pop\": 40806000, \"year\": 1985}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.6960000000000002, \"life_expect\": 72.244, \"pop\": 42869000, \"year\": 1990}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.514, \"life_expect\": 74.647, \"pop\": 45264146, \"year\": 1995}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.242, \"life_expect\": 77.045, \"pop\": 47351083, \"year\": 2000}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.21, \"life_expect\": 78.623, \"pop\": 48640671, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.72, \"life_expect\": 59.489, \"pop\": 1560985, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.689, \"life_expect\": 62.094, \"pop\": 1786235, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.336, \"life_expect\": 63.87, \"pop\": 2057945, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.78, \"life_expect\": 65.421, \"pop\": 2383029, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 4.311, \"life_expect\": 66.099, \"pop\": 3098159, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.895, \"life_expect\": 66.983, \"pop\": 3085876, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.313, \"life_expect\": 67.926, \"pop\": 3088235, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 3.0, \"life_expect\": 69.292, \"pop\": 3147267, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.6950000000000003, \"life_expect\": 70.265, \"pop\": 3334733, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.319, \"life_expect\": 71.028, \"pop\": 3578036, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.209, \"life_expect\": 71.993, \"pop\": 3826018, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.095, \"life_expect\": 72.99, \"pop\": 10750842, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.168, \"life_expect\": 73.23, \"pop\": 11486000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.797, \"life_expect\": 73.82, \"pop\": 12292000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 2.059, \"life_expect\": 73.75, \"pop\": 13032335, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.596, \"life_expect\": 75.24, \"pop\": 13653438, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5150000000000001, \"life_expect\": 76.05, \"pop\": 14143901, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.5550000000000002, \"life_expect\": 76.83, \"pop\": 14491380, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.583, \"life_expect\": 77.42, \"pop\": 14951510, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.6, \"life_expect\": 78.03, \"pop\": 15459054, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.726, \"life_expect\": 78.53, \"pop\": 15907853, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.721, \"life_expect\": 79.762, \"pop\": 16407491, \"year\": 2005}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.07, \"life_expect\": 70.26, \"pop\": 2136168, \"year\": 1955}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.022, \"life_expect\": 71.24, \"pop\": 2371746, \"year\": 1960}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 3.348, \"life_expect\": 71.52, \"pop\": 2640400, \"year\": 1965}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.843, \"life_expect\": 71.89, \"pop\": 2828050, \"year\": 1970}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.178, \"life_expect\": 72.22, \"pop\": 3117800, \"year\": 1975}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.963, \"life_expect\": 73.84, \"pop\": 3170150, \"year\": 1980}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.053, \"life_expect\": 74.32, \"pop\": 3298050, \"year\": 1985}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 2.061, \"life_expect\": 76.33, \"pop\": 3359604, \"year\": 1990}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.952, \"life_expect\": 77.55, \"pop\": 3565990, \"year\": 1995}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.964, \"life_expect\": 79.11, \"pop\": 3819762, \"year\": 2000}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.994, \"life_expect\": 80.204, \"pop\": 4035461, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 37.802, \"pop\": 35458978, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 39.36, \"pop\": 39914593, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 41.04, \"pop\": 45020052, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 42.821, \"pop\": 51027516, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 44.514, \"pop\": 58522112, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 45.826, \"pop\": 68550274, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.834, \"life_expect\": 46.886, \"pop\": 77573154, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.635, \"life_expect\": 47.472, \"pop\": 88510354, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.246, \"life_expect\": 47.464, \"pop\": 100960105, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.845, \"life_expect\": 46.608, \"pop\": 114306700, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.322, \"life_expect\": 46.859, \"pop\": 128765768, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.8369999999999997, \"life_expect\": 73.44, \"pop\": 3427409, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.898, \"life_expect\": 73.47, \"pop\": 3581239, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.719, \"life_expect\": 74.08, \"pop\": 3723153, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.248, \"life_expect\": 74.34, \"pop\": 3877386, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.81, \"life_expect\": 75.37, \"pop\": 4007313, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.687, \"life_expect\": 75.97, \"pop\": 4085620, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8, \"life_expect\": 75.89, \"pop\": 4152419, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8860000000000001, \"life_expect\": 77.32, \"pop\": 4242006, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.853, \"life_expect\": 78.32, \"pop\": 4359101, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8010000000000002, \"life_expect\": 79.05, \"pop\": 4492400, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8479999999999999, \"life_expect\": 80.196, \"pop\": 4593041, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 45.557, \"pop\": 44434445, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 47.67, \"pop\": 50386898, \"year\": 1960}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 49.8, \"pop\": 57494940, \"year\": 1965}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 51.929, \"pop\": 65705964, \"year\": 1970}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 54.043, \"pop\": 74711541, \"year\": 1975}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 56.158, \"pop\": 85219117, \"year\": 1980}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.66, \"life_expect\": 58.245, \"pop\": 99060352, \"year\": 1985}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 5.8, \"life_expect\": 60.838, \"pop\": 114578478, \"year\": 1990}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 4.9596, \"life_expect\": 61.818, \"pop\": 128690285, \"year\": 1995}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.9936, \"life_expect\": 63.61, \"pop\": 146342958, \"year\": 2000}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.5211, \"life_expect\": 65.483, \"pop\": 162419946, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 46.263, \"pop\": 8671500, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 49.096, \"pop\": 9931000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.5600000000000005, \"life_expect\": 51.445, \"pop\": 11467300, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.0, \"life_expect\": 55.448, \"pop\": 13192800, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 5.378, \"life_expect\": 58.447, \"pop\": 15161199, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.65, \"life_expect\": 61.406, \"pop\": 17295298, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 4.1, \"life_expect\": 64.134, \"pop\": 19348926, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.7, \"life_expect\": 66.458, \"pop\": 21511443, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 3.0995, \"life_expect\": 68.386, \"pop\": 23846388, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.7005, \"life_expect\": 69.906, \"pop\": 25979722, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.5065, \"life_expect\": 71.421, \"pop\": 27925628, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 7.13, \"life_expect\": 51.334, \"pop\": 24553055, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.85, \"life_expect\": 54.757, \"pop\": 28528939, \"year\": 1960}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.5, \"life_expect\": 56.393, \"pop\": 33267569, \"year\": 1965}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 6.0, \"life_expect\": 58.065, \"pop\": 38603696, \"year\": 1970}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 5.5, \"life_expect\": 60.06, \"pop\": 44336842, \"year\": 1975}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.95, \"life_expect\": 62.082, \"pop\": 50940182, \"year\": 1980}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.55, \"life_expect\": 64.151, \"pop\": 57288037, \"year\": 1985}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 4.143, \"life_expect\": 66.458, \"pop\": 64318120, \"year\": 1990}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.7248, \"life_expect\": 68.564, \"pop\": 71717437, \"year\": 1995}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.5436, \"life_expect\": 70.303, \"pop\": 79739825, \"year\": 2000}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.2327, \"life_expect\": 71.688, \"pop\": 87857473, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 3.29, \"life_expect\": 65.77, \"pop\": 27220668, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.65, \"life_expect\": 67.64, \"pop\": 29589842, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.27, \"life_expect\": 69.61, \"pop\": 31262358, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.25, \"life_expect\": 70.85, \"pop\": 32526000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.26, \"life_expect\": 70.67, \"pop\": 33969240, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.33, \"life_expect\": 71.32, \"pop\": 35578016, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 2.15, \"life_expect\": 70.98, \"pop\": 37225792, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.8900000000000001, \"life_expect\": 70.99, \"pop\": 38119408, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.478, \"life_expect\": 72.75, \"pop\": 38600642, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.251, \"life_expect\": 74.67, \"pop\": 38654164, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.227, \"life_expect\": 75.563, \"pop\": 38557984, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.03, \"life_expect\": 61.51, \"pop\": 8692600, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.074, \"life_expect\": 64.39, \"pop\": 9036700, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.849, \"life_expect\": 66.6, \"pop\": 9128850, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.748, \"life_expect\": 69.26, \"pop\": 9044200, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 2.41, \"life_expect\": 70.41, \"pop\": 9411090, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.982, \"life_expect\": 72.77, \"pop\": 9777800, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.5939999999999999, \"life_expect\": 74.06, \"pop\": 9897192, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.516, \"life_expect\": 74.86, \"pop\": 9922689, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.475, \"life_expect\": 75.97, \"pop\": 10065543, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.454, \"life_expect\": 77.29, \"pop\": 10335597, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.455, \"life_expect\": 78.098, \"pop\": 10566212, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.0, \"life_expect\": 41.5, \"pop\": 2698272, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.1, \"life_expect\": 43.0, \"pop\": 3031804, \"year\": 1960}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.2, \"life_expect\": 44.1, \"pop\": 3264640, \"year\": 1965}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.29, \"life_expect\": 44.6, \"pop\": 3769171, \"year\": 1970}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.492, \"life_expect\": 45.0, \"pop\": 4356863, \"year\": 1975}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.5, \"life_expect\": 46.218, \"pop\": 5138689, \"year\": 1980}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.25, \"life_expect\": 44.02, \"pop\": 6009833, \"year\": 1985}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.9, \"life_expect\": 23.599, \"pop\": 6923738, \"year\": 1990}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.0993, \"life_expect\": 36.087, \"pop\": 5706501, \"year\": 1995}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 6.01, \"life_expect\": 43.413, \"pop\": 7507056, \"year\": 2000}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 5.9169, \"life_expect\": 46.242, \"pop\": 8440820, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.175, \"life_expect\": 42.868, \"pop\": 4243218, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 45.914, \"pop\": 4718301, \"year\": 1960}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.257, \"life_expect\": 49.901, \"pop\": 5327432, \"year\": 1965}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.298, \"life_expect\": 53.886, \"pop\": 6109051, \"year\": 1970}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.2780000000000005, \"life_expect\": 58.69, \"pop\": 7204820, \"year\": 1975}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.015, \"life_expect\": 63.012, \"pop\": 9999161, \"year\": 1980}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 6.217, \"life_expect\": 66.295, \"pop\": 13330067, \"year\": 1985}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 5.446, \"life_expect\": 68.768, \"pop\": 16060761, \"year\": 1990}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 4.621, \"life_expect\": 70.533, \"pop\": 19966998, \"year\": 1995}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.81, \"life_expect\": 71.626, \"pop\": 23153090, \"year\": 2000}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.352, \"life_expect\": 72.777, \"pop\": 26417599, \"year\": 2005}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.5, \"life_expect\": 47.985, \"pop\": 15368551, \"year\": 1955}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.3, \"life_expect\": 49.951, \"pop\": 17416653, \"year\": 1960}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.7, \"life_expect\": 51.927, \"pop\": 19898242, \"year\": 1965}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.47, \"life_expect\": 53.696, \"pop\": 22739921, \"year\": 1970}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 5.0, \"life_expect\": 55.527, \"pop\": 25815144, \"year\": 1975}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 4.556, \"life_expect\": 58.161, \"pop\": 29251588, \"year\": 1980}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.85, \"life_expect\": 60.834, \"pop\": 34254092, \"year\": 1985}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 3.343, \"life_expect\": 61.888, \"pop\": 38391094, \"year\": 1990}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.954, \"life_expect\": 60.236, \"pop\": 41779149, \"year\": 1995}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.802, \"life_expect\": 53.365, \"pop\": 44066197, \"year\": 2000}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.637, \"life_expect\": 49.339, \"pop\": 44344136, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.75, \"life_expect\": 66.66, \"pop\": 29318745, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.89, \"life_expect\": 69.69, \"pop\": 30641187, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.92, \"life_expect\": 71.44, \"pop\": 32084511, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.86, \"life_expect\": 73.06, \"pop\": 33876479, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.5700000000000003, \"life_expect\": 74.39, \"pop\": 35563535, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.8900000000000001, \"life_expect\": 76.3, \"pop\": 37488360, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.48, \"life_expect\": 76.9, \"pop\": 38534853, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.27, \"life_expect\": 77.57, \"pop\": 39350769, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.182, \"life_expect\": 78.77, \"pop\": 39749715, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.287, \"life_expect\": 79.78, \"pop\": 40016081, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.409, \"life_expect\": 80.941, \"pop\": 40341462, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.34, \"life_expect\": 70.56, \"pop\": 4980000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.51, \"life_expect\": 71.32, \"pop\": 5362000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.27, \"life_expect\": 72.77, \"pop\": 5943000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.82, \"life_expect\": 73.78, \"pop\": 6267000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 75.39, \"pop\": 6403500, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 76.21, \"pop\": 6385229, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.53, \"life_expect\": 77.41, \"pop\": 6563770, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.54, \"life_expect\": 78.03, \"pop\": 6836626, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.47, \"life_expect\": 79.37, \"pop\": 7157106, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.415, \"life_expect\": 80.62, \"pop\": 7266920, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.42, \"life_expect\": 81.701, \"pop\": 7489370, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.6, \"life_expect\": 48.079, \"pop\": 24144571, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.19, \"life_expect\": 52.098, \"pop\": 28217122, \"year\": 1960}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.7, \"life_expect\": 54.336, \"pop\": 31950718, \"year\": 1965}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 5.3, \"life_expect\": 57.005, \"pop\": 35758382, \"year\": 1970}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.715, \"life_expect\": 59.507, \"pop\": 40529798, \"year\": 1975}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 4.15, \"life_expect\": 61.036, \"pop\": 45120802, \"year\": 1980}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 3.276, \"life_expect\": 63.108, \"pop\": 50669003, \"year\": 1985}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.904, \"life_expect\": 66.146, \"pop\": 56084632, \"year\": 1990}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.574, \"life_expect\": 68.835, \"pop\": 61188984, \"year\": 1995}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.23, \"life_expect\": 70.845, \"pop\": 65666677, \"year\": 2000}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.143, \"life_expect\": 71.777, \"pop\": 69660559, \"year\": 2005}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.49, \"life_expect\": 70.42, \"pop\": 50946000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.81, \"life_expect\": 70.76, \"pop\": 52372000, \"year\": 1960}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.52, \"life_expect\": 71.36, \"pop\": 54350000, \"year\": 1965}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.04, \"life_expect\": 72.01, \"pop\": 55632000, \"year\": 1970}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.72, \"life_expect\": 72.76, \"pop\": 56215000, \"year\": 1975}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.8, \"life_expect\": 74.04, \"pop\": 56314000, \"year\": 1980}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.81, \"life_expect\": 75.007, \"pop\": 56620240, \"year\": 1985}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.78, \"life_expect\": 76.42, \"pop\": 57493307, \"year\": 1990}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.7000000000000002, \"life_expect\": 77.218, \"pop\": 58426014, \"year\": 1995}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.695, \"life_expect\": 78.471, \"pop\": 59522468, \"year\": 2000}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.815, \"life_expect\": 79.425, \"pop\": 60441457, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.4585, \"life_expect\": 57.907, \"pop\": 6170497, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.657, \"life_expect\": 60.77, \"pop\": 7556483, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 5.9045000000000005, \"life_expect\": 63.479, \"pop\": 9067735, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.941, \"life_expect\": 65.712, \"pop\": 10758017, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 4.4685, \"life_expect\": 67.456, \"pop\": 12674987, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.957, \"life_expect\": 68.557, \"pop\": 14767890, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.6485000000000003, \"life_expect\": 70.19, \"pop\": 16997509, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 3.25, \"life_expect\": 71.15, \"pop\": 19325222, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.9415, \"life_expect\": 72.146, \"pop\": 21555902, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.723, \"life_expect\": 72.766, \"pop\": 23542649, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.547, \"life_expect\": 73.747, \"pop\": 25375281, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data).mark_line(\n",
    "    strokeWidth=3,\n",
    "    opacity=0.5,\n",
    "    interpolate='monotone'\n",
    ").encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('fertility:Q'),\n",
    "    alt.Color('country:N', legend=None),\n",
    "    alt.Tooltip('country:N')\n",
    ").properties(\n",
    "    width=400\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "_PZcXCF6OZm2"
   },
   "source": [
    "The `line` mark can also be used to create *slope graphs*, charts that highlight the change in value between two comparison points using line slopes.\n",
    "\n",
    "Below let's create a slope graph comparing the populations of each country at minimum and maximum years in our full dataset: 1955 and 2005. We first create a new Pandas data frame filtered to those years, then use Altair to create the slope graph.\n",
    "\n",
    "By default, Altair places the years close together. To better space out the years along the x-axis, we can indicate the size (in pixels) of discrete steps along the width of our chart as indicated by the comment below. Try adjusting the width `step` value below and see how the chart changes in response."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "glipk3XoKUcc",
    "outputId": "edd1292a-97a7-44d1-b2ec-c5b8d755aa86"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-248ce7ff54604df38fa0f83d278a9188\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-248ce7ff54604df38fa0f83d278a9188\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-cb152d9c221aa74672d5bedc49a3e5c7\"}, \"mark\": {\"type\": \"line\", \"opacity\": 0.5}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\", \"legend\": null}, \"tooltip\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\"}}, \"width\": {\"step\": 50}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-cb152d9c221aa74672d5bedc49a3e5c7\": [{\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.7, \"life_expect\": 30.332, \"pop\": 8891209, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Afghanistan\", \"fertility\": 7.0685, \"life_expect\": 43.828, \"pop\": 29928987, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 3.1265, \"life_expect\": 64.399, \"pop\": 18927821, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Argentina\", \"fertility\": 2.254, \"life_expect\": 75.32, \"pop\": 39537943, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 5.15, \"life_expect\": 64.381, \"pop\": 53865, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Aruba\", \"fertility\": 2.04, \"life_expect\": 74.239, \"pop\": 71566, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 3.406, \"life_expect\": 70.33, \"pop\": 9277087, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Australia\", \"fertility\": 1.788, \"life_expect\": 81.235, \"pop\": 20090437, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 2.52, \"life_expect\": 67.48, \"pop\": 6946885, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Austria\", \"fertility\": 1.42, \"life_expect\": 79.829, \"pop\": 8184691, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 4.305, \"life_expect\": 62.405, \"pop\": 87138, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bahamas\", \"fertility\": 2.0221, \"life_expect\": 73.495, \"pop\": 301790, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 6.76, \"life_expect\": 39.348, \"pop\": 49601520, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Bangladesh\", \"fertility\": 2.826, \"life_expect\": 64.062, \"pop\": 144319628, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 4.67, \"life_expect\": 62.57, \"pop\": 227255, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Barbados\", \"fertility\": 1.5, \"life_expect\": 77.296, \"pop\": 278870, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 2.496, \"life_expect\": 69.24, \"pop\": 8868475, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Belgium\", \"fertility\": 1.646, \"life_expect\": 79.441, \"pop\": 10364388, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 6.75, \"life_expect\": 41.89, \"pop\": 3074311, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Bolivia\", \"fertility\": 3.5, \"life_expect\": 65.554, \"pop\": 8857870, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 6.1501, \"life_expect\": 53.285, \"pop\": 61773546, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Brazil\", \"fertility\": 2.245, \"life_expect\": 72.39, \"pop\": 186112794, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 5.486, \"life_expect\": 56.074, \"pop\": 6743269, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Chile\", \"fertility\": 1.944, \"life_expect\": 78.553, \"pop\": 15980912, \"year\": 2005}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 5.59, \"life_expect\": 50.54896, \"pop\": 608655000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"China\", \"fertility\": 1.725, \"life_expect\": 72.961, \"pop\": 1303182268, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 6.76, \"life_expect\": 55.118, \"pop\": 13588405, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Colombia\", \"fertility\": 2.2205, \"life_expect\": 72.889, \"pop\": 42954279, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 7.1135, \"life_expect\": 60.026, \"pop\": 1031782, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Costa Rica\", \"fertility\": 2.0985, \"life_expect\": 78.782, \"pop\": 4016173, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 2.42, \"life_expect\": 64.77, \"pop\": 3955526, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Croatia\", \"fertility\": 1.346, \"life_expect\": 75.748, \"pop\": 4495904, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 3.6995, \"life_expect\": 62.325, \"pop\": 6381106, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Cuba\", \"fertility\": 1.49, \"life_expect\": 78.273, \"pop\": 11346670, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 7.6405, \"life_expect\": 49.828, \"pop\": 2737257, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Dominican Republic\", \"fertility\": 2.81, \"life_expect\": 72.235, \"pop\": 9049595, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 6.7, \"life_expect\": 51.356, \"pop\": 3842399, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Ecuador\", \"fertility\": 2.578, \"life_expect\": 74.994, \"pop\": 13363593, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 6.97, \"life_expect\": 44.444, \"pop\": 23855527, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Egypt\", \"fertility\": 2.891, \"life_expect\": 71.338, \"pop\": 77505756, \"year\": 2005}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 6.8065, \"life_expect\": 48.57, \"pop\": 2221139, \"year\": 1955}, {\"cluster\": 3, \"country\": \"El Salvador\", \"fertility\": 2.6825, \"life_expect\": 71.878, \"pop\": 6704932, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 2.769, \"life_expect\": 67.49, \"pop\": 4234900, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Finland\", \"fertility\": 1.8250000000000002, \"life_expect\": 79.313, \"pop\": 5223442, \"year\": 2005}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 2.7119999999999997, \"life_expect\": 68.93, \"pop\": 43427669, \"year\": 1955}, {\"cluster\": 1, \"country\": \"France\", \"fertility\": 1.8916, \"life_expect\": 80.657, \"pop\": 60656178, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 2.909, \"life_expect\": 62.625, \"pop\": 3827154, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Georgia\", \"fertility\": 1.407, \"life_expect\": 70.987, \"pop\": 4677401, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 2.3, \"life_expect\": 69.1, \"pop\": 70195612, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Germany\", \"fertility\": 1.3599999999999999, \"life_expect\": 79.406, \"pop\": 82431390, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 2.27, \"life_expect\": 67.86, \"pop\": 7965538, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Greece\", \"fertility\": 1.325, \"life_expect\": 79.483, \"pop\": 10668354, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 6.7, \"life_expect\": 63.114, \"pop\": 84621, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Grenada\", \"fertility\": 2.302, \"life_expect\": 68.724, \"pop\": 89502, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 6.3, \"life_expect\": 40.696, \"pop\": 3376419, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Haiti\", \"fertility\": 3.5445, \"life_expect\": 60.916, \"pop\": 8121622, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 4.72, \"life_expect\": 64.75, \"pop\": 2490400, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Hong Kong\", \"fertility\": 0.966, \"life_expect\": 82.208, \"pop\": 6898686, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 4.023, \"life_expect\": 73.47, \"pop\": 158044, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Iceland\", \"fertility\": 2.052, \"life_expect\": 81.757, \"pop\": 296737, \"year\": 2005}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 5.8961, \"life_expect\": 40.249, \"pop\": 393000000, \"year\": 1955}, {\"cluster\": 0, \"country\": \"India\", \"fertility\": 2.8073, \"life_expect\": 64.698, \"pop\": 1080264388, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 5.672, \"life_expect\": 39.918, \"pop\": 86807000, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Indonesia\", \"fertility\": 2.182, \"life_expect\": 70.65, \"pop\": 218465000, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 7.0, \"life_expect\": 47.181, \"pop\": 18729000, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iran\", \"fertility\": 2.04, \"life_expect\": 70.964, \"pop\": 68017860, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 7.3, \"life_expect\": 48.437, \"pop\": 5903253, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Iraq\", \"fertility\": 4.264, \"life_expect\": 59.545, \"pop\": 26074906, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 3.68, \"life_expect\": 68.9, \"pop\": 2916133, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Ireland\", \"fertility\": 1.964, \"life_expect\": 78.885, \"pop\": 4015676, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 3.893, \"life_expect\": 67.84, \"pop\": 1772032, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Israel\", \"fertility\": 2.75, \"life_expect\": 80.745, \"pop\": 6276883, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 2.35, \"life_expect\": 67.81, \"pop\": 48633000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Italy\", \"fertility\": 1.379, \"life_expect\": 80.546, \"pop\": 58103033, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 5.08, \"life_expect\": 62.61, \"pop\": 1488805, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Jamaica\", \"fertility\": 2.4289, \"life_expect\": 72.567, \"pop\": 2735520, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 2.08, \"life_expect\": 65.5, \"pop\": 89815060, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Japan\", \"fertility\": 1.27, \"life_expect\": 82.603, \"pop\": 127417244, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 7.816, \"life_expect\": 44.686, \"pop\": 7033999, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Kenya\", \"fertility\": 4.959, \"life_expect\": 54.11, \"pop\": 33829590, \"year\": 2005}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 3.8, \"life_expect\": 54.081, \"pop\": 8839427, \"year\": 1955}, {\"cluster\": 4, \"country\": \"South Korea\", \"fertility\": 1.85, \"life_expect\": 67.297, \"pop\": 22912177, \"year\": 2005}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 6.332, \"life_expect\": 52.681, \"pop\": 21551834, \"year\": 1955}, {\"cluster\": 4, \"country\": \"North Korea\", \"fertility\": 1.21, \"life_expect\": 78.623, \"pop\": 48640671, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 5.72, \"life_expect\": 59.489, \"pop\": 1560985, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Lebanon\", \"fertility\": 2.209, \"life_expect\": 71.993, \"pop\": 3826018, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 3.095, \"life_expect\": 72.99, \"pop\": 10750842, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Netherlands\", \"fertility\": 1.721, \"life_expect\": 79.762, \"pop\": 16407491, \"year\": 2005}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 4.07, \"life_expect\": 70.26, \"pop\": 2136168, \"year\": 1955}, {\"cluster\": 4, \"country\": \"New Zealand\", \"fertility\": 1.994, \"life_expect\": 80.204, \"pop\": 4035461, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 6.9, \"life_expect\": 37.802, \"pop\": 35458978, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Nigeria\", \"fertility\": 5.322, \"life_expect\": 46.859, \"pop\": 128765768, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 2.8369999999999997, \"life_expect\": 73.44, \"pop\": 3427409, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Norway\", \"fertility\": 1.8479999999999999, \"life_expect\": 80.196, \"pop\": 4593041, \"year\": 2005}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 6.6, \"life_expect\": 45.557, \"pop\": 44434445, \"year\": 1955}, {\"cluster\": 0, \"country\": \"Pakistan\", \"fertility\": 3.5211, \"life_expect\": 65.483, \"pop\": 162419946, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 6.853, \"life_expect\": 46.263, \"pop\": 8671500, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Peru\", \"fertility\": 2.5065, \"life_expect\": 71.421, \"pop\": 27925628, \"year\": 2005}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 7.13, \"life_expect\": 51.334, \"pop\": 24553055, \"year\": 1955}, {\"cluster\": 4, \"country\": \"Philippines\", \"fertility\": 3.2327, \"life_expect\": 71.688, \"pop\": 87857473, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 3.29, \"life_expect\": 65.77, \"pop\": 27220668, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Poland\", \"fertility\": 1.227, \"life_expect\": 75.563, \"pop\": 38557984, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 3.03, \"life_expect\": 61.51, \"pop\": 8692600, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Portugal\", \"fertility\": 1.455, \"life_expect\": 78.098, \"pop\": 10566212, \"year\": 2005}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 8.0, \"life_expect\": 41.5, \"pop\": 2698272, \"year\": 1955}, {\"cluster\": 2, \"country\": \"Rwanda\", \"fertility\": 5.9169, \"life_expect\": 46.242, \"pop\": 8440820, \"year\": 2005}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 7.175, \"life_expect\": 42.868, \"pop\": 4243218, \"year\": 1955}, {\"cluster\": 5, \"country\": \"Saudi Arabia\", \"fertility\": 3.352, \"life_expect\": 72.777, \"pop\": 26417599, \"year\": 2005}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 6.5, \"life_expect\": 47.985, \"pop\": 15368551, \"year\": 1955}, {\"cluster\": 2, \"country\": \"South Africa\", \"fertility\": 2.637, \"life_expect\": 49.339, \"pop\": 44344136, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 2.75, \"life_expect\": 66.66, \"pop\": 29318745, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Spain\", \"fertility\": 1.409, \"life_expect\": 80.941, \"pop\": 40341462, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 2.34, \"life_expect\": 70.56, \"pop\": 4980000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Switzerland\", \"fertility\": 1.42, \"life_expect\": 81.701, \"pop\": 7489370, \"year\": 2005}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 6.6, \"life_expect\": 48.079, \"pop\": 24144571, \"year\": 1955}, {\"cluster\": 1, \"country\": \"Turkey\", \"fertility\": 2.143, \"life_expect\": 71.777, \"pop\": 69660559, \"year\": 2005}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 2.49, \"life_expect\": 70.42, \"pop\": 50946000, \"year\": 1955}, {\"cluster\": 1, \"country\": \"United Kingdom\", \"fertility\": 1.815, \"life_expect\": 79.425, \"pop\": 60441457, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 6.4585, \"life_expect\": 57.907, \"pop\": 6170497, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Venezuela\", \"fertility\": 2.547, \"life_expect\": 73.747, \"pop\": 25375281, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataTime = data.loc[(data['year'] == 1955) | (data['year'] == 2005)]\n",
    "\n",
    "alt.Chart(dataTime).mark_line(opacity=0.5).encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('pop:Q'),\n",
    "    alt.Color('country:N', legend=None),\n",
    "    alt.Tooltip('country:N')\n",
    ").properties(\n",
    "    width={\"step\": 50} # adjust the step parameter\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "LLo0NmuncGAa"
   },
   "source": [
    "### Area Marks\n",
    "\n",
    "The `area` mark type combines aspects of `line` and `bar` marks: it visualizes connections (slopes) among data points, but also shows a filled region, with one edge defaulting to a zero-valued baseline."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "mYtoHUPuPpxW"
   },
   "source": [
    "The chart below is an area chart of population over time for just the United States:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "cXdOREmBHiaH",
    "outputId": "37cd899d-2ad1-42ea-fbe0-12e591a28326"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-216f247231bd4781a3c6830e063af3b1\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-216f247231bd4781a3c6830e063af3b1\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-5ec75749a8b91a020fd2730b61b83888\"}, \"mark\": \"area\", \"encoding\": {\"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"fertility\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-5ec75749a8b91a020fd2730b61b83888\": [{\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataUS = data.loc[data['country'] == 'United States']\n",
    "\n",
    "alt.Chart(dataUS).mark_area().encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('fertility:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "aDPZ6bWEPv2_"
   },
   "source": [
    "Similar to `line` marks, `area` marks support an `interpolate` parameter."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "-ZpfjqMxJvXF",
    "outputId": "eba5baab-44be-46ac-c9ae-0ad3b094573a"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-69a0b6ce0eb14dd6ac4f2a615b77a8a2\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-69a0b6ce0eb14dd6ac4f2a615b77a8a2\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-5ec75749a8b91a020fd2730b61b83888\"}, \"mark\": {\"type\": \"area\", \"interpolate\": \"monotone\"}, \"encoding\": {\"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"fertility\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-5ec75749a8b91a020fd2730b61b83888\": [{\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(dataUS).mark_area(interpolate='monotone').encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('fertility:Q')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "_YolZaDbP7jh"
   },
   "source": [
    "Similar to `bar` marks, `area` marks also support stacking. Here we create a new data frame with data for the three North American countries, then plot them using an `area` mark and a `color` encoding channel to stack by country."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "tYOS0Il_H8h3",
    "outputId": "70e210aa-4771-4ed9-e5a3-0af587d03c60"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-06b88dda9cd64a98bf889a14539913b6\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-06b88dda9cd64a98bf889a14539913b6\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-90247f35efb014c7706cfdd66a0e9a4d\"}, \"mark\": \"area\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-90247f35efb014c7706cfdd66a0e9a4d\": [{\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataNA = data.loc[\n",
    "    (data['country'] == 'United States') |\n",
    "    (data['country'] == 'Canada') |\n",
    "    (data['country'] == 'Mexico')\n",
    "]\n",
    "\n",
    "alt.Chart(dataNA).mark_area().encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('pop:Q'),\n",
    "    alt.Color('country:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "oVinPfTZpNtY"
   },
   "source": [
    "By default, stacking is performed relative to a zero baseline. However, other `stack` options are available:\n",
    "\n",
    "* `center` - to stack relative to a baseline in the center of the chart, creating a *streamgraph* visualization, and\n",
    "* `normalize` - to normalize the summed data at each stacking point to 100%, enabling percentage comparisons.\n",
    "\n",
    "Below we adapt the chart by setting the `y` encoding `stack` attribute to `center`. What happens if you instead set it `normalize`?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "6SQpyJzqpB5G",
    "outputId": "3a7cb75a-3acf-4b0e-d0e8-cdc7c85fd5ee"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-2bb99a7136eb40da8cea494b7139ad0a\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-2bb99a7136eb40da8cea494b7139ad0a\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-90247f35efb014c7706cfdd66a0e9a4d\"}, \"mark\": \"area\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\", \"stack\": \"center\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-90247f35efb014c7706cfdd66a0e9a4d\": [{\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(dataNA).mark_area().encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('pop:Q', stack='center'),\n",
    "    alt.Color('country:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "fQN5a3gfQFBW"
   },
   "source": [
    "To disable stacking altogether, set the  `stack` attribute to `None`. We can also add `opacity` as a default mark parameter to ensure we see the overlapping areas!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "MY8xDiqkKDMc",
    "outputId": "41345e53-eeaa-4c69-969d-738c1479ba26"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-055632f712994befb2cdaf5b02e2e90c\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-055632f712994befb2cdaf5b02e2e90c\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-90247f35efb014c7706cfdd66a0e9a4d\"}, \"mark\": {\"type\": \"area\", \"opacity\": 0.5}, \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"country\"}, \"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"pop\", \"stack\": null}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-90247f35efb014c7706cfdd66a0e9a4d\": [{\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(dataNA).mark_area(opacity=0.5).encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('pop:Q', stack=None),\n",
    "    alt.Color('country:N')\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "ro21p2rsQMl3"
   },
   "source": [
    "The `area` mark type also supports data-driven baselines, with both the upper and lower series determined by data fields. As with `bar` marks, we can use the `x` and `x2` (or `y` and `y2`) channels to provide end points for the area mark.\n",
    "\n",
    "The chart below visualizes the range of minimum and maximum fertility, per year, for North American countries:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 385
    },
    "colab_type": "code",
    "id": "I084oc4aQeMw",
    "outputId": "fb6d0868-79f4-4f96-8f5d-aff6d504b3fe"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-91aefb77c3884aeaaab0b1ce6f6d08d7\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-91aefb77c3884aeaaab0b1ce6f6d08d7\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-90247f35efb014c7706cfdd66a0e9a4d\"}, \"mark\": \"area\", \"encoding\": {\"x\": {\"type\": \"ordinal\", \"field\": \"year\"}, \"y\": {\"type\": \"quantitative\", \"aggregate\": \"min\", \"field\": \"fertility\"}, \"y2\": {\"aggregate\": \"max\", \"field\": \"fertility\"}}, \"width\": {\"step\": 40}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-90247f35efb014c7706cfdd66a0e9a4d\": [{\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(dataNA).mark_area().encode(\n",
    "    alt.X('year:O'),\n",
    "    alt.Y('min(fertility):Q'),\n",
    "    alt.Y2('max(fertility):Q')\n",
    ").properties(\n",
    "    width={\"step\": 40}\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "msL27DW2qoqJ"
   },
   "source": [
    "We can see a larger range of values in 1995, from just under 4 to just under 7. By 2005, both the overall fertility values and the variability have declined, centered around 2 children per familty."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "5BoLjQCgrHZL"
   },
   "source": [
    "All the `area` mark examples above use a vertically oriented area. However, Altair and Vega-Lite support horizontal areas as well. Let's transpose the chart above, simply by swapping the `x` and `y` channels."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 506
    },
    "colab_type": "code",
    "id": "l_TDR4SNrStr",
    "outputId": "e7bf35e5-c94b-4316-9f8d-0dc68f242763"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-9e3fead9886d42a98ea70eda8d3b2246\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-9e3fead9886d42a98ea70eda8d3b2246\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-90247f35efb014c7706cfdd66a0e9a4d\"}, \"mark\": \"area\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"aggregate\": \"min\", \"field\": \"fertility\"}, \"x2\": {\"aggregate\": \"max\", \"field\": \"fertility\"}, \"y\": {\"type\": \"ordinal\", \"field\": \"year\"}}, \"width\": {\"step\": 40}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-90247f35efb014c7706cfdd66a0e9a4d\": [{\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.882, \"life_expect\": 69.96, \"pop\": 16050356, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 3.675, \"life_expect\": 71.3, \"pop\": 18266765, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 2.61, \"life_expect\": 72.13, \"pop\": 20071104, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.976, \"life_expect\": 72.88, \"pop\": 21749986, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.734, \"life_expect\": 74.21, \"pop\": 23209200, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.634, \"life_expect\": 75.76, \"pop\": 24593300, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.616, \"life_expect\": 76.86, \"pop\": 25941600, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.694, \"life_expect\": 77.95, \"pop\": 27790600, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.564, \"life_expect\": 78.61, \"pop\": 29619002, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.522, \"life_expect\": 79.77, \"pop\": 31278097, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Canada\", \"fertility\": 1.5270000000000001, \"life_expect\": 80.653, \"pop\": 32805041, \"year\": 2005}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.8, \"life_expect\": 55.19, \"pop\": 32929914, \"year\": 1955}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 58.299, \"pop\": 38578505, \"year\": 1960}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.7495, \"life_expect\": 60.11, \"pop\": 45142399, \"year\": 1965}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 6.5, \"life_expect\": 62.361, \"pop\": 52775158, \"year\": 1970}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 5.2505, \"life_expect\": 65.032, \"pop\": 60678045, \"year\": 1975}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 4.25, \"life_expect\": 67.405, \"pop\": 68347479, \"year\": 1980}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.6295, \"life_expect\": 69.498, \"pop\": 76767225, \"year\": 1985}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 3.1905, \"life_expect\": 71.455, \"pop\": 84913652, \"year\": 1990}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.6705, \"life_expect\": 73.67, \"pop\": 92880353, \"year\": 1995}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.4005, \"life_expect\": 74.902, \"pop\": 99926620, \"year\": 2000}, {\"cluster\": 3, \"country\": \"Mexico\", \"fertility\": 2.211, \"life_expect\": 76.195, \"pop\": 106202903, \"year\": 2005}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.706, \"life_expect\": 69.49, \"pop\": 165931000, \"year\": 1955}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 3.314, \"life_expect\": 70.21, \"pop\": 180671000, \"year\": 1960}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.545, \"life_expect\": 70.76, \"pop\": 194303000, \"year\": 1965}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.016, \"life_expect\": 71.34, \"pop\": 205052000, \"year\": 1970}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.788, \"life_expect\": 73.38, \"pop\": 215973000, \"year\": 1975}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.8250000000000002, \"life_expect\": 74.65, \"pop\": 227726463, \"year\": 1980}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.924, \"life_expect\": 75.02, \"pop\": 238466283, \"year\": 1985}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.025, \"life_expect\": 76.09, \"pop\": 250131894, \"year\": 1990}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 1.994, \"life_expect\": 76.81, \"pop\": 266557091, \"year\": 1995}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.038, \"life_expect\": 77.31, \"pop\": 282338631, \"year\": 2000}, {\"cluster\": 3, \"country\": \"United States\", \"fertility\": 2.054, \"life_expect\": 78.242, \"pop\": 295734134, \"year\": 2005}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(dataNA).mark_area().encode(\n",
    "    alt.Y('year:O'),\n",
    "    alt.X('min(fertility):Q'),\n",
    "    alt.X2('max(fertility):Q')\n",
    ").properties(\n",
    "    width={\"step\": 40}\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "colab_type": "text",
    "id": "OAmIxLRarios"
   },
   "source": [
    "## Summary\n",
    "\n",
    "We've completed our tour of data types, encoding channels, and graphical marks! You should now be well-equipped to further explore the space of encodings, mark types, and mark parameters. For a comprehensive reference &ndash; including features we've skipped over here! &ndash; see the Altair [marks](https://altair-viz.github.io/user_guide/marks.html) and [encoding](https://altair-viz.github.io/user_guide/encoding.html) documentation.\n",
    "\n",
    "In the next module, we will look at the use of data transformations to create charts that summarize data or visualize new derived fields. In a later module, we'll examine how to further customize your charts by modifying scales, axes, and legends.\n",
    "\n",
    "Interested in learning more about visual encoding?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img title=\"Bertin's Taxonomy of Visual Encoding Channels\" src=\"https://cdn-images-1.medium.com/max/2000/1*jsb78Rr2cDy6zrE7j2IKig.png\" style=\"max-width: 650px;\"><br/>\n",
    "\n",
    "<small>Bertin's taxonomy of visual encodings from <a href=\"https://books.google.com/books/about/Semiology_of_Graphics.html?id=X5caQwAACAAJ\"><em>Sémiologie Graphique</em></a>, as adapted by <a href=\"https://bost.ocks.org/mike/\">Mike Bostock</a>.</small>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- The systematic study of marks, visual encodings, and backing data types was initiated by [Jacques Bertin](https://en.wikipedia.org/wiki/Jacques_Bertin) in his pioneering 1967 work [_Sémiologie Graphique (The Semiology of Graphics)_](https://books.google.com/books/about/Semiology_of_Graphics.html?id=X5caQwAACAAJ). The image above illustrates position, size, value (brightness), texture, color (hue), orientation, and shape channels, alongside Bertin's recommendations for the data types they support.\n",
    "- The framework of data types, marks, and channels also guides _automated_ visualization design tools, starting with [Mackinlay's APT (A Presentation Tool)](https://scholar.google.com/scholar?cluster=10191273548472217907) in 1986 and continuing in more recent systems such as [Voyager](http://idl.cs.washington.edu/papers/voyager/) and [Draco](http://idl.cs.washington.edu/papers/draco/).\n",
    "- The identification of nominal, ordinal, interval, and ratio types dates at least as far back as S. S. Steven's 1947 article [_On the theory of scales of measurement_](https://scholar.google.com/scholar?cluster=14356809180080326415)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
